summarize_samples: Summarize data across functions

View source: R/summarize_samples.R

summarize_samplesR Documentation

Summarize data across functions

Description

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.

Usage

## Default S3 method:
summarize_samples(data, group_cols, .fns = list(mean = mean), cor = FALSE, ...)

## S3 method for class 'mild_df'
summarize_samples(data, ...)

Arguments

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 list(mean = mean)).

cor

A logical (default FALSE) for whether to include correlations between all features in the summarization.

...

Arguments passed to or from other methods.

Value

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.

Methods (by class)

  • default: Method for data.frame-like objects.

  • mild_df: Method for mild_df objects.

Author(s)

Sean Kent

Examples

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)


mildsvm documentation built on July 14, 2022, 9:08 a.m.