expand: An 'expand.grid'-like function that repeats sets of vectors...

Description Usage Arguments Value Author(s) References Examples

Description

The values of x are repeated for each combination of elements in the vectors supplied via ..., with the first elements of each vector in ... being taken as a set, the second elements as another set, and so on. x is repeated for each of these sets.

Usage

1
expand(x, ...)

Arguments

x

numeric; vector of data points which are to be replicated for each of the sets of vectors supplied to ....

...

additional vector arguments to be expanded to the correct length. These are taken to be a set of values to be replicated for each of the elements of x.

Value

a matrix of replicated vectors, with column names for x and named arguments passed as ....

Author(s)

Gavin L. Simpson

References

Minchin P.R. (1987) Simulation of multidimensional community patterns: towards a comprehensive model. Vegetatio 71, 145–156.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Recreate Fig. 2 of Minchin (1987)
# Parameters for each of 6 six species
A0 <- c(5,4,7,5,9,8) * 10
m <- c(25,85,10,60,45,60)
r <- c(3,3,4,4,6,5) * 10
alpha <- c(0.1,1,2,4,1.5,1)
gamma <- c(0.1,1,2,4,0.5,4)
# Gradient locations
x <- 1:100

# expand parameter set
pars <- expand(x, m = m, A0 = A0, r = r, alpha = alpha,
               gamma = gamma)
head(pars)

gavinsimpson/coenocliner documentation built on Feb. 9, 2021, 4:11 p.m.