Free Access Week-  Data Engineering + BI
Data engineering and BI courses are free!
Free AI Access Week from June 2-8

ecodist (version 1.2.9)

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<critical value(alpha) to 0

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<critical value(alpha) to 0. Computes this critical value as a t-test with n-2 df.

Examples

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