View source: R/summarize_samples.R
summarize_samples | R Documentation |
Summarize a numeric data frame based on specified grouping columns and a list
of functions. This is useful in summarizing a mild_df
object from the
sample level to the instance level.
## Default S3 method: summarize_samples(data, group_cols, .fns = list(mean = mean), cor = FALSE, ...) ## S3 method for class 'mild_df' summarize_samples(data, ...)
data |
A data.frame, 'mild_df' object, or similar of data to summarize. |
group_cols |
A character vector of column(s) that describe groups to summarize across. |
.fns |
A list of functions (default |
cor |
A logical (default |
... |
Arguments passed to or from other methods. |
A tibble with summarized data. There will be one row for each set
of distinct groups specified by group_cols
. There will be one column for
each of the group_cols
, plus length(.fns)
columns for each of the
features in data
, plus correlation columns if specified.
default
: Method for data.frame-like objects.
mild_df
: Method for mild_df
objects.
Sean Kent
fns <- list(mean = mean, sd = sd) summarize_samples(mtcars, group_cols = c("cyl", "gear"), .fns = fns) summarize_samples(mtcars, group_cols = c("cyl", "gear"), .fns = fns, cor = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.