correls2: Correlation between a vector and a matrix

View source: R/filters.R

correls2R Documentation

Correlation between a vector and a matrix

Description

Fast Pearson/Spearman correlation where y is vector, x is matrix, adapted from stats::cor.test.

Usage

correls2(y, x, method = "pearson", use = "complete.obs")

Arguments

y

Numerical vector

x

Matrix

method

Type of correlation, either "pearson" or "spearman".

use

Optional character string giving a method for computing covariances in the presence of missing values. See cor

Details

For speed, p-values for Spearman's test are computed by asymptotic t approximation, equivalent to cor.test with exact = FALSE.

Value

Matrix with columns containing the correlation statistic, either Pearson r or Spearman rho, and p-values for each column of x correlated against vector y


nestedcv documentation built on June 22, 2024, 11:30 a.m.