Function method for use_contrasts
If the user provides a function, use the function and supplied arguments to create a contrast matrix
## S3 method for class '`function`' use_contrasts( factor_col, code_by = NA, reference_level = NA, set_intercept = NA, drop_trends = NA, labels = NULL, as_is = FALSE, ... )
factor_col
: A factor vector, eg from df$factorVarNamecode_by
: A function to be called, should return a contrast matrixreference_level
: The name of the level to use as the reference level, default NAset_intercept
: The intercept to use, default NAdrop_trends
: The trends to drop, default NAlabels
: A vector of labels to apply to the matrix column names, defaultas_is
: Logical, default FALSE, whether to leave the resulting matrix...
: Additional arguments to be passed to code_by()
A contrast coding matrix with labels and proper reference level
use_contrasts(gl(5,1), sum_code)
Useful links