Re: [S] How to do a "one-to-many merge" in SPlus?

Tim Hesterberg (timh@statsci.com)
Thu, 17 Sep 1998 08:58:56 -0700 (PDT)


John Oehlert asked how to do bootstrapping by resampling
patients with varying numbers of cases.
Here is an example of how to do with with the bootstrap() function:

# Bootstrap when patients have varying number of cases.
DF <- data.frame(ID=rep(101:103, c(4,5,6)), x=1:15)
DF # Patient 101 has 4 cases, 102 has 5, 103 has 6.

index.list <- split(1:nrow(DF), DF$ID)
# Sample from index.list, use the corresponding rows:
bootstrap(index.list,
nrow(DF[unlist(index.list),]))
# Replace nrow() with a function that does what you want.

========================================================
| Tim Hesterberg Research Scientist |
| timh@statsci.com MathSoft/Statistical Sciences |
| (206)283-8802x319 1700 Westlake Ave. N, Suite 500 |
| (206)283-0347 (fax) Seattle, WA 98109-3044, U.S.A. |
========================================================
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news