View source: R/bruceR-stats_1_basic.R
Describe | R Documentation |
Descriptive statistics.
Describe( data, all.as.numeric = TRUE, digits = 2, nsmall = digits, file = NULL, plot = FALSE, upper.triangle = FALSE, upper.smooth = "none", plot.file = NULL, plot.width = 8, plot.height = 6, plot.dpi = 500 )
data |
Data frame or numeric vector. |
all.as.numeric |
|
digits, nsmall |
Number of decimal places of output. Default is |
file |
File name of MS Word ( |
plot |
|
upper.triangle |
|
upper.smooth |
|
plot.file |
|
plot.width |
Width (in "inch") of the saved plot. Default is |
plot.height |
Height (in "inch") of the saved plot. Default is |
plot.dpi |
DPI (dots per inch) of the saved plot. Default is |
Invisibly return a list consisting of
(1) a data frame of descriptive statistics and
(2) a ggplot2
object if users set plot=TRUE
.
Corr
set.seed(1) Describe(rnorm(1000000), plot=TRUE) Describe(airquality) Describe(airquality, plot=TRUE, upper.triangle=TRUE, upper.smooth="lm") # ?psych::bfi Describe(psych::bfi[c("age", "gender", "education")]) 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) }) Describe(d[, .(age, gender, education)], plot=TRUE, all.as.numeric=FALSE) Describe(d[, .(age, gender, education, E, A, C, N, O)], plot=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.