[R] Random subset

Roland Rau roland.rproject at gmail.com
Wed Jul 30 20:45:53 CEST 2008


But probably you will need to set replace=FALSE if you want to sample 
from your original data set without replacement.

Sorry for the possible confusion,
Roland


Roland Rau wrote:
> Hi,
> 
> check
> ?sample
> 
> n <- 200
> mydata.set <- rnorm(100000)
> my.random.subset <- sample(x=mydata.set, size=n, replace=TRUE)
> 
> my.random.subset
> 
> 
> I hope this helps,
> Roland
> 
> 
> 
> Alessandro wrote:
>> Hi all,
>>
>>  
>>
>> I wish to do a random subset (i.e. 200 or 300 points) from a dataset, 
>> but I
>> don't find the right code in R.
>>
>>  
>>
>> Thanks for help
>>
>>  
>>
>> alessandro
>>
>>
>>     [[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.
>>
> 
> ______________________________________________
> 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