On Apr 29, 2010, at 7:26 PM, Chris__ Barker wrote:

I'm trying to bootstrap resample from a repeated measures dataset. I sample
a vector of "ID"'s from my dataframe with replacement.
Then I merge this back with my dataframe.
I'm re-sampling subjects in the dataset rather than rows of the data.

I thought I could use the left/right join features of the merge to select
the records I want from the dataframe (mydataframe), like this.

boot.sample <- merge( id.boot.draw,mydataframe, by=c("ID") , all.x=TRUE )


when I do that, the correct records are selected from "mydataframe" but the values for all the variables, other than the matching variable are now "NA".

Cannot say. No data provided. But have you considered drawing your sample from rowsamp <- row.names(mydataframe) , and then just working with:

boot.samp <-  mydataframe[rowsamp,  ]




My other option is to right a for loop, which I would hope to avoid.

Thanks in advance for any suggestions
--
David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to