corSubsetPairs: Compute correlations between pairs of features

View source: R/RcppExports_parents.R View source: R/RcppExports.R

corSubsetPairsR Documentation

Compute correlations between pairs of features

Description

Compute correlations between pairs of features given in idxi and idxj

Usage

corSubsetPairs(
  Y,
  idxi,
  idxj,
  method = c("pearson", "spearman"),
  silent = FALSE,
  setNANtoZero = FALSE
)

Arguments

Y

matrix where rows are features

idxi

indecies

idxj

indecies

method

specify which correlation method: "pearson" or "spearman"

silent

suppress messages

setNANtoZero

replace NAN correlation values with a zero

Value

Compute local correlations between for all k: cor(Y[,idxi[k]], Y[,idxj[k]])

Examples

# Simulate simple dataset
N = 600
Y = matrix(rnorm(N*100), 100, N)

# select pairs to compute correlations between
i1 = sample.int(N, 200, replace=TRUE)
i2 = sample.int(N, 200, replace=TRUE)

# evaluate all piars
C = corSubsetPairs(t(Y), i1,i2)

# show value
C[i1[10], i2[10]]

# show values from evaluating this pair directly
cor(Y[,i1[10]], Y[,i2[10]])


GabrielHoffman/decorate documentation built on May 23, 2023, 1:29 a.m.