-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
Consider a dataframe with two factor columns x and y, where x has only one level and y has more than one level.
> data.frame(x = factor(c(1, 1)),
+ y = gl(2,1)) |>
+ set_contrasts(x ~ sum_code)
Expect contr.treatment or contr.poly for unset factors: y
Error in enlist_contrasts(model_data, !!!formulas, verbose = verbose) :
No factors with more than 1 level found
In addition: Warning message:
Contrasts undefined for factors with only one level: x The error states "No factors with more than 1 level found", with the intent being "I didn't find a factor with more than 1 level in the factors you specified in your set_contrasts call". An alternative, more exhaustive, reading is "I looked at the rest of the data in the dataframe and didn't see any factors with more than 1 level". This is confusing, as it suggests that the function checked y and incorrectly determined that it, too, had 1 level.
The wording should be adjusted to be No factors with more than 1 level were provided
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation