Allows to run cor.test on a matrix of inputs.
Usage
cor_fast(
x,
y = NULL,
use = "everything",
method = "pearson",
alternative = "two.sided",
continuity = FALSE,
include_only = NULL,
return_matrix = TRUE
)Arguments
- x
a numeric vector, matrix, or data frame.
- y
NULL (default) or a vector.
- use
an optional character string giving a method for computing correlations in the presence of missing values. This must be (an abbreviation of) one of the strings "everything", "all.obs", "complete.obs", or "pairwise.complete.obs".
- method
which correlation method to use, "pearson" or "spearman"
- alternative
how to perform the statistical test
- continuity
should a continuity correction be applied
- include_only
only run the correlations that include the members (as a vector) or combinations (as a list or data.frame)
- return_matrix
should the matrices of values be returned, or a long data.frame
Details
Although the interface is mostly identical to the built-in
stats::cor.test() method, there are some differences.
if only
xis provided as a matrix, the columns must be named.if providing both
xandy, it is assumed they are both single vectors.if
NAvalues are present, this function does not error, but will either remove them or returnNA, depending on the option."na.or.complete" is not a valid option for
use.A named list with matrices or data.frame is returned, with the
rho,pvalue, and number of non-NAvalues.