tidymodels / hardhat

Construct Modeling Packages
https://hardhat.tidymodels.org
Other
101 stars 16 forks source link

`validate_outcomes_has_type(outcomes, ptype)` #84

Closed DavisVaughan closed 5 years ago

DavisVaughan commented 5 years ago

Wrap vctrs::vec_assert() and test that each column of outcomes has type ptype.

DavisVaughan commented 5 years ago

I would either map over the columns of outcomes since that would be a data frame and check the type, or I would take numeric() and create a full data frame prototype using that. So it would look like data.frame(col1 = numeric(), col2 = numeric()) etc. Then you could use 1 call to vec_assert() and it would take care of the rest

DavisVaughan commented 5 years ago

Not currently possible because vctrs doesn't allow "learned" factor partial types like vec_assert(x, factor()). This would fail because it would look for something with 0 levels.

DavisVaughan commented 5 years ago

maybe we can revisit later, but for now just use validate_outcomes_are_factors()

github-actions[bot] commented 3 years ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.