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)[1], 3, replace=TRUE), ]

Spencer Graves

Ko-Kang Kevin Wang wrote:
Hi,

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?


______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to