Description Usage Arguments Value Examples
View source: R/grouped_summary.R
Descriptive statistics for multiple variables for all grouping variable levels
1 2 3 4 5 6 7 8 9 | grouped_summary(
data,
grouping.vars,
measures = NULL,
measures.type = "numeric",
topcount.long = FALSE,
k = 2L,
...
)
|
data |
Dataframe from which variables need to be taken. |
grouping.vars |
A list of grouping variables. Please use unquoted
arguments (i.e., use |
measures |
List variables for which summary needs to computed. If not
specified, all variables of type specified in the argument |
measures.type |
A character indicating whether summary for numeric
("numeric") or factor/character ("factor") variables is expected
(Default: |
topcount.long |
If |
k |
Number of digits. |
... |
Currently ignored. |
Dataframe with descriptive statistics for numeric variables (n, mean, sd, median, min, max).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # for reproducibility
set.seed(123)
# another possibility
groupedstats::grouped_summary(
data = iris,
grouping.vars = Species,
measures = Sepal.Length:Petal.Width,
measures.type = "numeric"
)
# if no measures are chosen, all relevant columns will be summarized
groupedstats::grouped_summary(
data = ggplot2::msleep,
grouping.vars = vore,
measures.type = "factor"
)
# for factors, you can also convert the dataframe to a long format with counts
groupedstats::grouped_summary(
data = ggplot2::msleep,
grouping.vars = c(vore),
measures = c(genus:order),
measures.type = "factor",
topcount.long = TRUE
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.