correlation {diggit} | R Documentation |
This function computes the correlation between x and y given both are numeric vectors, between the columns of x if it is a numeric matrix, or between the columns of x and y if both are numeric matrixes
correlation(x, y = NULL, method = c("pearson", "spearman", "kendall"), pairwise = FALSE)
x |
Numeric vector or matrix |
y |
Optional numeric vector or matrix |
method |
Character string indicating the correlation method |
pairwise |
Logical, wether columns of x and y should be compared in a pairwise manner. x and y must have the same number of columns |
This function computes correlation and associated p-values
Numeric value, vector or matrix of results
x <- seq(0, 10, length=50) y <- x+rnorm(length(x), sd=2) correlation(x, y)