[R] Stratified random sampling in R?

Jonathan Greenberg greenberg at ucdavis.edu
Sat Feb 21 03:55:51 CET 2004


Is there an easy way to do a stratified random sampling based on a factor
column in R?  E.g. I want to extract a random 10% of the data from dataset
for each class (so each class may have a different number of entries,
depending on its size).  On a related note, if this is easily doable, is
there an easy way to extract TWO non-overlapping strat. random samples
datasets (e.g. If I want to have a training and test dataset).  Thanks!

--j

-- 
Jonathan Greenberg
Graduate Group in Ecology, U.C. Davis
http://www.cstars.ucdavis.edu/~jongreen
http://www.cstars.ucdavis.edu
AIM: jgrn307 or jgrn3007
MSN: jgrn307 at msn.com or jgrn3007 at msn.com




More information about the R-help mailing list