Mike, It works for me:
> data <- 1:8 > sample(data,replace=TRUE) [1] 6 4 5 2 5 8 7 2 Please provide a reproducible example, if possible, and the output of sessionInfo(). Jonathan On Tue, Sep 28, 2010 at 7:22 PM, Michael Larkin <mlar...@rsmas.miami.edu>wrote: > I am trying to get R to randomly select values from my dataset (i.e. > bootstrapping) with replacement. However, my attempts at this have been > unsuccessful. Here is a basic example of what I am doing: > > I have a data vector of 8 values (i.e. data= 2,5,9,4,5,6,7,8). I used the > sample function and it worked. However, it only repeated my values in the > exact same order as the dataset. It did not randomly sample them. Here > the > code for what I did: > > sample(data, replace=TRUE) > > Any advice to randomly select data from my dataset would be greatly > appreciated. > > Mike > > > > > [[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. > [[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.