[R] Sampling from data set

Jeffrey Spies jspies at virginia.edu
Tue Oct 5 09:13:57 CEST 2010


We'll probably need much more info, but this should get you started:

nameOfDataSet[sample(1:10000, 100),]

You can replace the 10000 with dim(nameOfDataSet)[1] to make it more dynamic.

Jeff.

On Tue, Oct 5, 2010 at 3:07 AM, Jumlong Vongprasert
<jumlong.ubru at gmail.com> wrote:
> Dear all.
> I have data with 2 variable x,y size 10000.
> I want to sampling from this data with size 100.
> How I can do it.
> THANK.
>
> --
> Jumlong Vongprasert
> Institute of Research and Development
> Ubon Ratchathani Rajabhat University
> Ubon Ratchathani
> THAILAND
> 34000
>
>        [[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.
>



More information about the R-help mailing list