Corr {bruceR} | R Documentation |
Correlation analysis.
Description
Correlation analysis.
Usage
Corr(
data,
method = "pearson",
p.adjust = "none",
all.as.numeric = TRUE,
digits = 2,
file = NULL,
plot = TRUE,
plot.r.size = 4,
plot.colors = NULL,
plot.file = NULL,
plot.width = 8,
plot.height = 6,
plot.dpi = 500
)
Arguments
data |
Data frame. |
method |
|
p.adjust |
Adjustment of p values for multiple tests:
|
all.as.numeric |
|
digits |
Number of decimal places of output. Defaults to |
file |
File name of MS Word ( |
plot |
|
plot.r.size |
Font size of correlation text label. Defaults to |
plot.colors |
Plot colors (character vector). Defaults to "RdBu" of the Color Brewer Palette. |
plot.file |
|
plot.width |
Width (in "inch") of the saved plot. Defaults to |
plot.height |
Height (in "inch") of the saved plot. Defaults to |
plot.dpi |
DPI (dots per inch) of the saved plot. Defaults to |
Value
Invisibly return a list with
(1) correlation results from
psych::corr.test()
and
(2) a ggplot2
object if plot=TRUE
.
See Also
Examples
Corr(airquality)
Corr(airquality, p.adjust="bonferroni",
plot.colors=c("#b2182b", "white", "#2166ac"))
d = as.data.table(psych::bfi)
added(d, {
gender = as.factor(gender)
education = as.factor(education)
E = .mean("E", 1:5, rev=c(1,2), range=1:6)
A = .mean("A", 1:5, rev=1, range=1:6)
C = .mean("C", 1:5, rev=c(4,5), range=1:6)
N = .mean("N", 1:5, range=1:6)
O = .mean("O", 1:5, rev=c(2,5), range=1:6)
})
Corr(d[, .(age, gender, education, E, A, C, N, O)])