Learn R Programming

ecodist (version 1.1.0)

cor2m: Generates a correlation table between the variables of 2 matrices

Description

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)

Usage

cor2m(x, y, trim = TRUE, alpha = 0.05)

Arguments

x
A matrix of species (or other) variables
y
A matrix of environmental (or other) variables matching the sites of x
trim
If trim is TRUE, set rho
alpha
alpha p-value to use with trim

Value

  • Returns a correlation table between the variables of 2 matrices.

Details

Correlate variables from 1 matrix with variables from another matrix. If TRIM, set rho

Examples

Run this code
# 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