use_contrasts.default function

Default method for use_contrasts

Default method for use_contrasts

If a user doesn't specify a contrast matrix, use the defaults from options(). If the user tries to use something we don't know how to work with, throw a warning that we'll be using the defaults from options().

## Default S3 method: use_contrasts( factor_col, code_by = NA, reference_level = NA, set_intercept = NA, drop_trends = NA, labels = NULL, as_is = FALSE, ... )

Arguments

  • factor_col: A factor vector, eg from df$factorVarName
  • code_by: Some object that's not a matrix or function. If NA, no warning will be thrown, and the default contrasts will be used. A warning will be thrown if it's not NA.
  • reference_level: Not used
  • set_intercept: Not used
  • drop_trends: Not used
  • labels: A vector of labels to apply to the matrix column names, default
  • as_is: Logical, default FALSE, whether to leave the resulting matrix
  • ...: Additional arguments, not used

Returns

Contrast matrix, using the ordered or unordered default from options()

Examples

use_contrasts(gl(5,1), helmert_code) # a function my_matrix <- helmert_code(5) use_contrasts(gl(5,1), my_matrix) # a matrix
  • Maintainer: Thomas Sostarics
  • License: MIT + file LICENSE
  • Last published: 2024-10-01