Learn R Programming

idmodelr (version 0.4.0)

summarise_strat_var: Sum a Stratified Variable

Description

Sum a Stratified Variable

Usage

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

Value

Returns the original dataframe with an additional summarised variable

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

See Also

summarise_var_by_strat

Examples

Run this code
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")

Run the code above in your browser using DataLab