cor: Correlation (Sparse and Dense Matrices)

Description Usage Arguments Details Value Examples

View source: R/correlation.R

Description

cor computes the sample correlation between each column pair in sparse or dense matrices.

Usage

1
2
3
4
5
6
7
cor(x, ...)

## Default S3 method:
cor(x, ...)

## S3 method for class 'CsparseMatrix'
cor(x, ...)

Arguments

x

A matrix or CsparseMatrix.

...

Additional arguments to pass to methods.

Details

cor() is an S3 generic with methods for:

Value

A pxp matrix where p is the number of matrix columns, and the (i, j) th element corresponds to the sample correlation between p_i and p_j.

Examples

1
2
3
4
5
x <- Matrix::rsparsematrix(10, 3, .5)
xdense <- as.matrix(x)

cor(x)
cor(xdense)

dmolitor/sparseprepr documentation built on Jan. 7, 2022, 9:58 p.m.