Try this: x[x$ind %in% sample(x$ind, 3),]
On Tue, Dec 9, 2008 at 3:19 PM, legendy <[EMAIL PROTECTED]> wrote: > > Hallo, All, > > I have a question needs your help. > I just want get a sample with the original index. For example, I have a > dataset, > > ind x > 1 39 > 2 24 > 3 15 > 4 75 > 5 61 > > After resample, I want to get a new dataset like this (with the original > index) > > ind x > 3 15 > 5 61 > 1 39 > > Thank you in advance. > > Legendy > > > > > > -- > View this message in context: > http://www.nabble.com/Resampling-with-index-tp20919265p20919265.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[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.