[R] extracting a percentage of data by random

From: Chang Liu <changisme_at_hotmail.com>
Date: Wed, 05 Mar 2008 16:49:53 -0800

Hello Gurus:  

If I have a dataframe with one of the variables called "age" for example, and I want to extract a random 10% of the observations from each "age" group of the entire data frame. Do I have to double loop to split the data and then loop again to assign random numbers? Or is there a better way to do this?  


        [[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 06 Mar 2008 - 00:53:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 06 Mar 2008 - 02:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive