Skip to content
Prev 306921 / 398506 Next

random sampling inside a dataset

On 12-10-04 6:06 AM, Gian Maria Niccol? Benucci wrote:
The sample() works on vectors, not dataframes.  Since dataframes are 
lists containing the columns, it was trying to sample columns, not rows.

This would give you a sample of rows:

ostrya[sample(1:536, 200, replace=FALSE),]

Duncan Murdoch