powered by
Sum a Stratified Variable
summarise_strat_var(df, vars, strat = NULL, new_var = "sum")
Returns the original dataframe with an additional summarised variable
A dataframe of model output.
A character vector containing the unstratified variables to summarise
The number of stratifications present in the data set
The name of the summarised variable
summarise_var_by_strat
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