Learn R Programming

thisutils (version 0.0.7)

pearson_correlation: Correlation and covariance calculation for sparse matrix

Description

Correlation and covariance calculation for sparse matrix

Usage

pearson_correlation(x, y = NULL)

Value

A list with covariance and correlation matrices.

Arguments

x

Sparse matrix or character vector.

y

Sparse matrix or character vector.

Examples

Run this code
m1 <- simulate_sparse_matrix(
  100, 100
)
m2 <- simulate_sparse_matrix(
  100, 100,
  sparsity = 0.05
)
a <- pearson_correlation(m1, m2)
a$cov[1:5, 1:5]
a$cor[1:5, 1:5]

Run the code above in your browser using DataLab