View source: R/gather_strat_variable.R
gather_strat_variable | R Documentation |
A Function to Gather a Stratified Variable into a Tidy Format
gather_strat_variable( df, id_col, compartment, hold_out_var = NULL, strat, groups = NULL )
df |
A data frame with variables stratified using numeric labels. |
id_col |
A character string containing the name of the new id column. |
compartment |
The compartment to reduce the dimension of. |
hold_out_var |
A character vector specifying the variables to keep unchanged. Defaults to NULL |
strat |
An integer specifying the number of stratifications to reduce. |
groups |
A character vector with length equal to the level of stratification. Used to name the stratified levels. |
A dataframe of stratified model output with a single Tidy variable.
df <- data.frame(time = 0, A1 = 1, A2 = 2, A3 = 3) gather_strat_variable(df, id_col = "Age", compartment = "A", strat = 3, groups = c("Children", "Young adults", "Adults"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.