Learn R Programming

diggit (version 1.4.0)

correlation: Correlation test

Description

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

Usage

correlation(x, y = NULL, method = c("pearson", "spearman", "kendall"), pairwise = FALSE)

Arguments

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

Value

Numeric value, vector or matrix of results

Details

This function computes correlation and associated p-values

Examples

Run this code
x <- seq(0, 10, length=50)
y <- x+rnorm(length(x), sd=2)
correlation(x, y)

Run the code above in your browser using DataLab