Description Usage Arguments Value Author(s) References See Also Examples
similar to comblist2() function
1 | comblist(parvector, parnum)
|
parvector |
parvector is a parameter sampling point vector |
parnum |
parnum is the number of parameters |
return all combinations of parameter sampling point spaces
Youhua Chen <yhchen@zoology.ubc.ca>
Chen YH (2012) coexist: an R package for performing species coexistence modeling and analysis under asymmetric dispersal and fluctuating source-sink dynamics. http://code.google.com/p/coexist.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (parvector, parnum)
{
combnum <- length(parvector)^parnum
mat <- matrix(0, ncol = parnum, nrow = combnum)
for (i in 1:parnum) {
leg <- length(parvector)^(parnum - i)
period = length(parvector)^i
repeated = length(parvector)^(i - 1)
fullcircle = leg * length(parvector)
temp <- vector()
length(temp) <- fullcircle
for (k in 1:length(parvector)) {
temp[((k - 1) * leg + 1):(k * leg)] = parvector[k]
}
for (ii in 1:repeated) {
mat[((ii - 1) * fullcircle + 1):(ii * fullcircle),
i] = temp
}
}
return(mat)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.