[R] how to subsample all possible combinations of n species taken 1:n at a time?

David Katz david at davidkatzconsulting.com
Tue Apr 7 01:39:34 CEST 2009


This is very cool indeed until you want to use more than 32 or so terms and
most operating systems force you to go to floating point. 

> x=sample(2^34,1000)
Error in sample(2^34, 1000) : invalid 'x' argument
In addition: Warning message:
In sample(2^34, 1000) : NAs introduced by coercion



jholtman wrote:
> 
> Are you just trying to obtain a combination from 25 possible terms?
> If so, then just sample the number you want and convert the number to
> binary:
> 
>> sample(33554432,100)
>   [1]  6911360  5924262 23052661 12888381 25831589 16700013 24079278
> 33282839 12751862 26086726 31363494  7118320 21866536  4212929
>  

David Katz
www.davidkatzconsulting.com

-- 
View this message in context: http://www.nabble.com/how-to-subsample-all-possible-combinations-of-n-species-taken-1%3An-at-a-time--tp22911399p22919597.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list