Description Usage Arguments Value Examples
Generate a simple set of summary statistics for a numeric vector or the numeric columns of a data.frame over various subsets. There are MANY other ways to do this but this function is suitable to my needs.
1 2 3 4 5 6 7 8 |
data |
a |
... |
additional arguments passed onto various methods. |
digits |
an integer to specify the number of decimal places desired for
the resulting summary statistics. Passed directly to |
f |
a formula. See the examples and |
order |
a logical value. If TRUE (default), the rows of the resulting
|
a data.frame
in which each row represents a variable-grouping
permutation.
1 2 3 4 5 6 7 8 9 10 11 12 | # Numeric vector
sumstats(mtcars$disp)
# All variables summarized and no grouping
sumstats(mtcars)
sumstats(iris)
# Only 'Petal.Width' and 'Sepal.Width' summarize and no grouping
sumstats(iris, cbind(Petal.Width, Sepal.Width) ~ NULL)
# All variables summarized and grouped by 'Species'
sumstats(iris, . ~ Species)
# 'mpg' and 'wt' summarized by 'cyl' and 'vs'
sumstats(mtcars, cbind(mpg, wt) ~ cyl + vs)
sumstats(mtcars, cbind(mpg, wt) ~ cyl + vs, order = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.