[R] Randomly extract rows from a data frame

Amy Whitehead alw76 at student.canterbury.ac.nz
Mon Feb 19 04:10:30 CET 2007


Hi,

I am looking for a way to randomly extract a specified number of rows from a
data frame.  I was planning on binding a column of random numbers to the
data frame and then sorting the data frame using this bound column.  But I
can't figure out how to use this column to sort the entire data frame so
that the content of the rows remains together.  Does anyone know how I can
do this?  Hints for other ways to approach this problem would also be
appreciated.

Cheers
Amy
 

Amy Whitehead 
School of Biological Sciences 
University of Canterbury 
Private Bag 4800 
Christchurch 
Ph 03 364 2987 ext 7033 
Cellphone 021 2020525 
Email alw76 at student.canterbury.ac.nz



More information about the R-help mailing list