An optimized, efficient implemntation for computing the pearson correlation.
pcor(x, y, use = "everything", inplace = FALSE, inverse = FALSE)tpcor(x, y, use = "everything", inplace = FALSE, inverse = FALSE)
A numeric dataframe/matrix or vector.
A vector (when x
is a vector) or missing (blank) when
x
is a matrix.
The NA handler, as in R's cov()
and cor()
functions. Options are "everything", "all.obs", and
"complete.obs".
Logical; if TRUE
then the method used is slower but
uses less memory than if FALSE
. See ?coop-package
for details.
Logical; should the inverse covariance matrix be returned?
The pearson correlation matrix.
See ?coop
for implementation details.
# NOT RUN {
x <- matrix(rnorm(10*3), 10, 3)
coop::pcor(x)
coop::pcor(x[, 1], x[, 2])
# }
Run the code above in your browser using DataLab