Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

factor_to_indicators errors with unhelpful message if a factor has only one level #285

Open
benkeser opened this issue Aug 1, 2020 · 0 comments
Labels

Comments

@benkeser
Copy link

benkeser commented Aug 1, 2020

grbg <- data.table(y = 1:10, x = as.factor(rep("F", 10)), z = 1:10)

grbg_task <- sl3_Task$new(data = grbg,
                          covariates = c("x", "z"),
                          outcome = "y")

grbg_task$X

Obviously this is sort of a user error, but the error message is

Error in ind_ref_mat[as.numeric(x), , drop = FALSE] : 
  incorrect number of dimensions

which is not helpful. And I could see users processing data without fully checking that all levels of a factor are present (that's what I did 😳).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants