Correlation analysis with plot and stats table

Correlation analysis with plot and stats table

fitCOR(data, x, y, range = NULL, log = "", ...)

Arguments

data

data frame containing x and y variables

x

character indicating the column name of the x variable in data

y

character indicating the column name of the y variable in data

range

plot range of the y values

log

character, "", "x", "y", or "xy" to log-transform values.

...

Arguments going to aes_string in the geom_point layer of the plot.

Value

list with plot, stats table, and correlation test output

Examples

if (FALSE) { # \dontrun{
data <- MASS::mvrnorm(100, c(x = 1, y = 10), Sigma = matrix(c(2,3,3,9), nrow = 2))
data <- setNames(as.data.frame(data), c("x", "y"))
data$study <- ifelse(runif(100)>0.5, "Study 1", "Study2")
fitCOR(data, "x", "y")
fitCOR(data, "x", "y", color = "study") # using the `...`-argument
} # }