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".

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

Thanks in advance for any suggestions

-- 
              Chris Barker,

        [[alternative HTML version deleted]]

______________________________________________
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