[R] Sampling from a Data Frame
spencer.graves at pdf.com
Fri Apr 4 22:30:51 CEST 2003
What do you want?
The following selects 3 rows at random from DataFrame:
DataFrame <- data.frame(x=1:9, y=rnorm(9))
DataFrame[sample(dim(DataFrame), 3, replace=TRUE), ]
Ko-Kang Kevin Wang wrote:
> I've been looking through the documentation for sample(), but can only get
> it to work with vectors. Is it possible to sample from a dataframe?
More information about the R-help