powered by
Evaluates code_by, then applies the appropriate use_contrasts method
code_by
# S3 method for name use_contrasts( factor_col, code_by = NA, reference_level = NA, set_intercept = NA, drop_trends = NA, labels = NULL, as_is = FALSE, ... )
A contrast coding matrix with labels and proper reference level
A factor vector, eg from df$factorVarName
A symbol to be evaluated
The level to use as the reference level, default NA
The intercept to use, default NA
The trends to drop, default NA
A vector of labels to apply to the matrix column names, default NULL (no new labels)
Logical, default FALSE, whether to leave the resulting matrix as-is
Additional arguments to be passed on
aliased_scheme <- sum_code contrast_scheme <- rlang::sym("aliased_scheme") # Result will be as if sum_code was used directly use_contrasts(gl(5,1), contrast_scheme)
Run the code above in your browser using DataLab