corSubsetPairs: Compute correlations between pairs of features

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Compute correlations between pairs of features given in idxi and idxj

Usage

1
2
3
4
5
6
7
8
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 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 July 26, 2021, 12:18 a.m.