[R] Sampling with replacement

David Winsemius dwinsemius at comcast.net
Wed Jun 16 17:29:45 CEST 2010


On Jun 16, 2010, at 10:20 AM, Somnath Somnath wrote:

> Dear all, good morning,
>
> I have a population, let say members are tagged with some simple  
> number like
> 1,2,3,...20. I want to draw a sample with replacement of size 4  
> (say, can be
> more than 20 also).

Already answered on the list.

> Is there any R function which will show me all such
> possible samples?

?expand.grid

 > nrow(expand.grid(1:20, 1:20, 1:20, 1:20))
[1] 160000

-- 
David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list