Combine two factor variables to make an interaction variable. Factor level order is determined by the order in the variables themselves. Note, names of the factor variables should not be quoted. The name of the variable is created from the names of the two factors. The variable is also labelled with a name derived from any pre-existing labels.
ff_interaction(.data, ..., levels_sep = "_", var_sep = "_", label_sep = ":") finalfit_interaction( .data, ..., levels_sep = "_", var_sep = "_", label_sep = ":" )
The unquoted names of two factors.
Quoted character: how levels are separated in new variable.
Quoted character: how variable name is separated.
Quoted character: how variable label is separated
Original data frame with new variable added via `dplyr::mutate`.
colon_s %>% ff_interaction(sex.factor, perfor.factor) %>% summary_factorlist("mort_5yr", "sex.factor_perfor.factor") #> Note: dependent includes missing data. These are dropped. #> label levels Alive Died #> Sex:Perforation Female_No 238 (46.6) 186 (46.0) #> Female_Yes 5 (1.0) 8 (2.0) #> Male_No 259 (50.7) 205 (50.7) #> Male_Yes 9 (1.8) 5 (1.2)