correlation: Calculating the correlation of each sample of a matrix.

View source: R/scLearn.R

correlationR Documentation

Calculating the correlation of each sample of a matrix.

Description

Sometimes, we need calculate the correlation of each sample of a matrix. This function can calculate the correlation among each sample of a matrix with metrics(pearson,spearman,cosin or euclidean) by parallel.

Usage

correlation(matrix, method = c("pearson", "spearman", "cosin", "euclidean"), cpu_num = 8)

Arguments

matrix

A matrix with column is sample, row is feature.

method

The metric to calculate the correlation. Four metrics("pearson", "spearman", "cosin", "euclidean") are supported.

cpu_num

The number of cpu used for parallel calculation.

Value

A matrix showing the correlation with column and row are both sample.

Author(s)

Bin Duan


bm2-lab/scLearn documentation built on Dec. 17, 2024, 8:18 p.m.