Displaying 1 result from an estimated 1 matches for "numspploop".
2009 Apr 06
3
how to subsample all possible combinations of n species taken 1:n at a time?
...at
about 25 taxa.
The expand.grid() method:
n <- 11
toto <- vector("list",n)
titi <- lapply(toto,function(x) c(0,1))
tutu <- expand.grid(titi)
The combn() method (a slightly lengthlier function):
samplecommunityD<- function(n,numsamples)
{
super<-mat.or.vec(,n)
for (numspploop in 1:n)
{
minor<-t(combn(n,numspploop))
if (dim(minor)[1]<numsamples)
{
minot<-mat.or.vec(dim(minor)[1],n)
for (loopi in 1:dim(minor)[1])
{
for (loopbi in 1:dim(minor)[2])
{
minot[loopi,minor[loopi,loopbi]] <- 1
}
}
super<-rbind(sup...