qstats | R Documentation |
This function provides descriptive statistics for a quantitative variable alone or separately by groups. Any function that returns a single numeric value can bue used.
qstats(data, x, ..., stats = c("n", "mean", "sd"), na.rm = TRUE, digits = 2)
data |
data frame |
x |
numeric variable in data (unquoted) |
... |
list of grouping variables |
stats |
statistics to calculate (any function that produces a
numeric value), Default: |
na.rm |
if |
digits |
number of decimal digits to print, Default: 2 |
a data frame, where columns are grouping variables (optional) and statistics
# If no keyword arguments are provided, default values are used qstats(mtcars, mpg, am, gear) # You can supply as many (or no) grouping variables as needed qstats(mtcars, mpg) qstats(mtcars, mpg, am, cyl) # You can specify your own functions (e.g., median, # median absolute deviation, minimum, maximum)) qstats(mtcars, mpg, am, gear, stats = c("median", "mad", "min", "max"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.