summarise_measures {expstudy} | R Documentation |
Aggregate an experience study
Description
summarise_measures()
functions the same as dplyr::summarise()
and
returns a new data frame per combination of grouping variable. However,
this function is is streamlined to return the sum of an experience study's
measures instead of any arbitrary summary function. These measures are
identified via the measure_sets
argument which can be provided directly
or be guessed using regular expressions (regexs
). See
guess_measure_sets()
for additional detail on how this guessing is
implemented.
Usage
summarise_measures(
.data,
measure_sets = guess_measure_sets(.data),
na.rm = TRUE,
.groups = "drop",
.by = NULL
)
Arguments
.data |
A |
measure_sets |
A (potentially named) list of measure sets. Only need to specify once if
chaining multiple |
na.rm |
logical. Should missing values (including |
.groups |
Grouping structure of the result.
When
In addition, a message informs you of that choice, unless the result is ungrouped,
the option "dplyr.summarise.inform" is set to |
.by |
< |
Value
An object usually of the same type as .data
.
The rows come from the underlying
group_keys()
.The columns are a combination of the grouping keys and the summary expressions that you provide.
The grouping structure is controlled by the
.groups=
argument, the output may be another grouped_df, a tibble or a rowwise data frame.Data frame attributes are not preserved, because
summarise()
fundamentally creates a new data frame.
Naming convention
expstudy
uses a naming convention where some functions are prefixed by the
underling dplyr
verb. The purpose of this is to associate the resulting
structure of the expstudy
function with a very similar output as what the
dplyr
function would produce. Note that the intention here is not replace
all dplyr
use cases but instead add specific functionality to streamline
routine experience study analyses.
Examples
mortexp |>
dplyr::group_by(
UNDERWRITING_CLASS
) |>
summarise_measures()