tidymodels / hardhat

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

Validate unique column names #93

Closed DavisVaughan closed 4 years ago

DavisVaughan commented 5 years ago

This would be an optional but helpful check that column names in the data frame / matrix are unique. Maybe with vec_as_names(repair = "check_unique")

DavisVaughan commented 4 years ago

The vec_as_names() errors are so good we might as well just encourage people to use that. The only reason to wrap it would be to give our own error message, but I don't think we need that.

library(vctrs)

vec_as_names(c("..1", "..2"), repair = "check_unique")
#> Error: Names must not be of the form `...` or `..j`.

vec_as_names(c("", "x"), repair = "check_unique")
#> Error: Names must not be empty.

vec_as_names(c("x", "x"), repair = "check_unique")
#> Error: Names must be unique.

Created on 2019-11-20 by the reprex package (v0.3.0.9000)

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.