Learn R Programming

summarytools (version 0.6.5)

descr: Descriptive Univariate Statistics for Numerical Data

Description

Calculates mean, standard deviation, min, max, median, mad, IQR (non-weighted only), CV, skewness (non-weighted only), SE.skewness (non-weighted only), and kurtosis (non-weighted only)

Usage

descr(x, na.rm=TRUE, round.digits=2, style="simple", justify="right", plain.ascii=TRUE, file=NA, append=FALSE, transpose=FALSE, escape.pipe=FALSE, weights=NA, rescale.weights=FALSE, ...)

Arguments

x
Numerical vector.
na.rm
argument to be passed to statistical functions. Defaults to TRUE.
round.digits
Number of sig. digits to keep. Defaults to 2.
style
Style of pander tables; one of “simple” (default), “grid” and “rmarkdown”.
justify
pander argument. Defaults to “right”.
plain.ascii
pander argument; when results are displayed in console, this avoids having markdown markup characters in the tables. Defaults to TRUE, except when style='rmarkdown', in which case it is set to FALSE (unless explicitly defined as TRUE).
file
File name to write output to. Defaults to NA. To append output to an existing text file, use append=TRUE.
append
When “file” argument is supplied, this indicates whether to append output to existing file (TRUE) or to overwrite any existing file (FALSE, default). If TRUE and no file exists, a new file will be created.
transpose
Makes variables appears as columns, and stats as rows. Defaults to FALSE.
escape.pipe
Only useful when style='grid' and file argument is not NA, in which case it will escape the pipe character (|) in order for Pandoc to correctly display table cells.
weights
Vector of weights, having same length as x
rescale.weights
Logical parameter. When TRUE, the function makes the sum of weights equal to the length of x, so that the total N remains unchanged. FALSE by default.
...
Additional arguments passed to pander.

Value

summarytool's print method.

Details

The default plain.ascii=TRUE option is there to make results appear clean in the console, but creates problems when generating markdown documents. For this reason, whenever style='rmarkdown', the option is set to FALSE, unless plain.ascii=TRUE is stated explicitly. On the other hand, with style='grid', if the intent is to produce markdown text, then the user needs to explicitly set plain.ascii=FALSE.

References

https://github.com/dcomtois/summarytools

Examples

Run this code
data(exams)
descr(exams)
descr(exams, transpose=TRUE)
data(tobacco)
with(tobacco, by(age, smoker, descr))

Run the code above in your browser using DataLab