Calculates mean, sd, min, Q1*, median, Q3*, max, MAD, IQR*, CV, skewness*, SE.skewness*, and kurtosis* on numerical vectors. (*) Not available when using sampling weights.
descr(x, stats = st_options("descr.stats"), na.rm = TRUE,
round.digits = st_options("round.digits"),
transpose = st_options("descr.transpose"), style = st_options("style"),
plain.ascii = st_options("plain.ascii"), justify = "right",
omit.headings = st_options("omit.headings"),
display.labels = st_options("display.labels"), split.tables = 100,
weights = NA, rescale.weights = FALSE, ...)
A numerical vector or a data frame.
Which stats to produce. Either “all” (default), or a
selection of : “mean”, “sd”, “min”, “q1”, “med”,
“q3”, “max”, “mad”, “iqr”, “cv”, “skewness”,
“se.skewness”, “kurtosis”, “n.valid”, and “pct.valid”.
This can be set globally via st_options
(“descr.stats”).
Argument to be passed to statistical functions. Defaults to
TRUE
. Can be set globally; see st_options
.
Number of significant digits to display. Defaults to
2
, and can be set globally (see st_options
).
Logical. Makes variables appears as columns, and stats as rows.
Defaults to FALSE
. To change this default value, see st_options
(option “descr.transpose”).
Style to be used by pander
when rendering
output table; One of “simple” (default), “grid”, or “rmarkdown”
This option can be set globally; see st_options
.
Logical. pander
argument; when
TRUE
, no markup characters will be used (useful when printing
to console). Defaults to TRUE
unless style = 'rmarkdown'
,
in which case it will be set to FALSE
automatically. To change the default
value globally, see st_options
.
Alignment of numbers in cells; “l” for left, “c” for center, or “r” for right (default). Has no effect on html tables.
Logical. Set to TRUE
to omit heading section. Can be set
globally via st_options
.
Logical. Should variable / data frame labels be displayed in
the title section? Default is TRUE
. To change this default value globally,
see st_options
.
Pander argument that specifies how many characters wide a
table can be. 100
by default.
Vector of weights having same length as x. NA
(default) indicates that no weights are used.
Logical. When set to TRUE
, the
total count will be the same as the unweighted x
. FALSE
by
default.
Additional arguments passed to pander
.
A matrix object containing the statistics, with extra attributes used by summarytool's print method.
# NOT RUN {
data(exams)
descr(exams)
descr(exams, stats = c("mean", "sd", "min", "max"), transpose = TRUE)
data(tobacco)
with(tobacco, view(by(BMI, gender, descr), method = "pander"))
# }
Run the code above in your browser using DataLab