summarise_strat_var: Sum a Stratified Variable

View source: R/summarise_strat_var.R

summarise_strat_varR Documentation

Sum a Stratified Variable

Description

Sum a Stratified Variable

Usage

summarise_strat_var(df, vars, strat = NULL, new_var = "sum")

Arguments

df

A dataframe of model output.

vars

A character vector containing the unstratified variables to summarise

strat

The number of stratifications present in the data set

new_var

The name of the summarised variable

Value

Returns the original dataframe with an additional summarised variable

See Also

summarise_var_by_strat

Examples

df <- dplyr::mutate(iris, Petal.Length1 = Petal.Length, Petal.Length2 = Petal.Length)
df <- tibble::as_tibble(df)

summarise_strat_var(df, vars = c("Petal.Length"), strat = 2, new_var = "sum")

idmodelr documentation built on Sept. 2, 2022, 5:06 p.m.