View source: R/RcppExports_parents.R View source: R/RcppExports.R
corSubsetPairs | R Documentation |
Compute correlations between pairs of features given in idxi and idxj
corSubsetPairs(
Y,
idxi,
idxj,
method = c("pearson", "spearman"),
silent = FALSE,
setNANtoZero = FALSE
)
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 |
Compute local correlations between for all k: cor(Y[,idxi[k]], Y[,idxj[k]])
# 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]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.