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

jim holtman jholtman at gmail.com
Tue Apr 7 03:45:35 CEST 2009


If you want 128 combinations, then generate 8 16-bit random numbers
and concatenate them together.  You will have to check for dups as you
generate the sequence, but it is at least a start and should fit
within the memory of the system.

On Mon, Apr 6, 2009 at 7:39 PM, David Katz
<david at davidkatzconsulting.com> wrote:
>
> 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.
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list