find_correlations: Generic function to find a correlation between two columns of...

Description Usage Arguments Value Examples

View source: R/datacollation.R

Description

Generic function to find a correlation between two columns of a dataframe

Usage

1
2
find_correlations(summary, factor1, factor2, result_name, min_count,
  ReturnCI = FALSE, method = "spearman")

Arguments

summary

dataframe

factor1

char name of first column in the summary dataframe

factor2

char name of second column in the summary dataframe

result_name

char name to give the result

min_count

minimum number of items in each column (otherwise result will be NA)

ReturnCI

whether to return confidence intervals

Value

Correlation between the two columns (or NA if either factor1 or factor2 contains NA, or if all values of factor1 or factor2 are identical). Also return the pValue on the spearman correlation coefficient and the associated confidence interval at a 0.95 level.

Examples

1
2
3
4
s1 <- data.frame(a = 1:3, b = 1:3 * (1 + rnorm(3) / 10))
find_correlations(s1, "a", "b", "c", 3)
# also return 0.95-CI on the spearman correlation coefficient:
find_correlations(s1, "a", "b", "c", 3, TRUE)

robjohnnoble/demonanalysis documentation built on June 30, 2020, 12:47 a.m.