descr | R Documentation |
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, var = NULL, stats = st_options("descr.stats"), na.rm = TRUE, round.digits = st_options("round.digits"), transpose = st_options("descr.transpose"), order = "sort", style = st_options("style"), plain.ascii = st_options("plain.ascii"), justify = "r", headings = st_options("headings"), display.labels = st_options("display.labels"), split.tables = 100, weights = NA, rescale.weights = FALSE, ... )
x |
A numerical vector or a data frame. |
var |
Unquoted expression referring to a specific column in |
stats |
Character. Which stats to produce. Either “all” (default),
“fivenum”, “common” (see Details), or a selection of :
“mean”, “sd”, “min”, “q1”, “med”,
“q3”, “max”, “mad”, “iqr”, “cv”,
“skewness”, “se.skewness”, “kurtosis”,
“n.valid”, and “pct.valid”. Can be set globally via
|
na.rm |
Logical. Argument to be passed to statistical functions.
Defaults to |
round.digits |
Numeric. Number of significant digits to display.
Defaults to |
transpose |
Logical. Make variables appears as columns, and stats as
rows. Defaults to |
order |
Character. When analyzing more than one variable, this parameter determines how to order variables. Valid values are “sort” (or simply “s”), “preserve” (or “p”), or a vector containing all variable names in the desired order. Defaults to “sort”. |
style |
Character. Style to be used by |
plain.ascii |
Logical. |
justify |
Character. Alignment of numbers in cells; “l” for left, “c” for center, or “r” for right (default). Has no effect on html tables. |
headings |
Logical. Set to |
display.labels |
Logical. Show variable / data frame labels in heading
section. Defaults to |
split.tables |
Character. |
weights |
Numeric. Vector of weights having same length as x.
|
rescale.weights |
Logical. When set to |
... |
Additional arguments passed to |
An object having classes “matrix” and
“summarytools” containing the statistics, with extra
attributes used by print
method and view function.
Dominic Comtois, dominic.comtois@gmail.com
data("exams") # All stats for all numerical variabls descr(exams) # Only common statistics descr(exams, stats = "common") # Arbitrary selection of statistics, transposed descr(exams, stats = c("mean", "sd", "min", "max"), transpose = TRUE) # Rmarkdown-ready descr(exams, plain.ascii = FALSE, style = "rmarkdown") # Grouped statistics data("tobacco") with(tobacco, stby(BMI, gender, descr)) # Grouped statistics, transposed with(tobacco, stby(BMI, age.gr, descr, stats = "common", transpose = TRUE)) ## Not run: # Show in Viewer (or browser if not in RStudio) view(descr(exams)) # Save to html file with title print(descr(exams), file = "descr_exams.html", report.title = "BMI by Age Group", footnote = "<b>Schoolyear:</b> 2018-2019<br/><b>Semester:</b> Fall") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.