cor2m generates a correlation table between the variables of 2 matrices--by design, species and environment. It stores these in a table with species as columns and envnvironmental variables as rows, so it's easy to scan. It also removes correlations less than a user-specified alpha (0.05 by default)
cor2m(x, y, trim = TRUE, alpha = 0.05)
A matrix of species (or other) variables
A matrix of environmental (or other) variables matching the sites of x
If trim is TRUE, set rho<critical value(alpha) to 0
alpha p-value to use with trim
Returns a correlation table between the variables of 2 matrices.
Correlate variables from 1 matrix with variables from another matrix. If TRIM, set rho<critical value(alpha) to 0. Computes this critical value as a t-test with n-2 df.
# NOT RUN {
# toy example
speciesdata <- matrix(runif(50), nrow=10)
colnames(speciesdata) <- c("spA", "spB", "spC", "spD", "spE")
envdata <- matrix(runif(30), nrow=10)
colnames(envdata) <- c("var1", "var2", "var3")
sppenv.cor <- cor2m(speciesdata, envdata)
# }
Run the code above in your browser using DataLab