View source: R/summary_stats.R
| summary_stats | R Documentation |
This function calculates various descriptive statistics (robust and non-robust) for a specified variable or all variables in a given data frame or tibble.
summary_stats(
x,
var = NULL,
digits = 2,
robust = FALSE,
drop_na = TRUE,
drop.na = deprecated()
)
x |
A data frame or tibble. |
var |
A character vector of names (or a numeric vector of column positions) specifying the variable(s) for which to calculate the summary statistics. If left as |
digits |
An integer specifying the number of significant digits to display after the decimal point in the output. |
robust |
A logical value indicating whether to compute robust descriptive statistics. If |
drop_na |
A logical value indicating whether to remove missing values ( |
drop.na |
A tibble with one row per variable. The classical statistics are the mean,
mode, median, IQR, standard deviation, variance, coefficient of variation
(cv, in \
the median, MAD (scaled to be consistent at the normal distribution), Qn and Sn
estimators, medcouple, left/right medcouples, biweight location, scale and
midvariance, robust coefficient of variation (rcv = MAD / median, in \
Robust statistics that cannot be computed (e.g. for a constant variable) are NA.
Christian L. Goueguel
data(forageLIBS)
# mineral contents (%) of the forage samples
summary_stats(forageLIBS[c("Ca", "Mg", "P", "K", "S")])
summary_stats(forageLIBS, var = c("Ca", "K"), robust = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.