test_between_factors {cola} | R Documentation |
Test whether a list of factors are correlated
test_between_factors(x, y = NULL, all_factors = FALSE, verbose = FALSE)
x |
a data frame or a vector which contains discrete or continuous variables. if |
y |
a data frame or a vector which contains discrete or continuous variables. |
all_factors |
are all columns in |
verbose |
whether to print messages. |
Pairwise test is applied to every two columns in the data frames. Methods are:
two numeric variables: correlation test by cor.test
is applied;
two character or factor variables: chisq.test
is applied;
one numeric variable and one character/factor variable: oneway ANOVA test by oneway.test
is applied.
This function can be used to test the correlation between the predicted classes and other known factors.
A matrix of p-values. If there are NA values, basically it means there are no efficient data points to perform the test.
Zuguang Gu <z.gu@dkfz.de>
df = data.frame(v1 = rnorm(100), v2 = sample(letters[1:3], 100, replace = TRUE), v3 = sample(LETTERS[5:6], 100, replace = TRUE)) test_between_factors(df) x = runif(100) test_between_factors(x, df)