tests/testthat/_snaps/model-matrix.md

contr_one_hot() input checks

Code
  contr_one_hot(n = 2, sparse = TRUE)
Condition
  Warning:
  `sparse = TRUE` not implemented for `contr_one_hot()`.
Output
    1 2
  1 1 0
  2 0 1
Code
  contr_one_hot(n = 2, contrasts = FALSE)
Condition
  Warning:
  `contrasts = FALSE` not implemented for `contr_one_hot()`.
Output
    1 2
  1 1 0
  2 0 1
Code
  contr_one_hot(n = 1:2)
Condition
  Error in `contr_one_hot()`:
  ! `n` must be a whole number, not an integer vector.
Code
  contr_one_hot(n = list(1:2))
Condition
  Error in `contr_one_hot()`:
  ! `n` must be a whole number, not a list.
Code
  contr_one_hot(character(0))
Condition
  Error in `contr_one_hot()`:
  ! `n` cannot be empty.
Code
  contr_one_hot(-1)
Condition
  Error in `contr_one_hot()`:
  ! `n` must be a whole number larger than or equal to 1, not the number -1.
Code
  contr_one_hot(list())
Condition
  Error in `contr_one_hot()`:
  ! `n` must be a whole number, not an empty list.


Try the hardhat package in your browser

Any scripts or data that you put into this service are public.

hardhat documentation built on April 4, 2025, 3:18 a.m.