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

Check type of na_rm? #349

Open
mikemahoney218 opened this issue Dec 10, 2022 · 2 comments
Open

Check type of na_rm? #349

mikemahoney218 opened this issue Dec 10, 2022 · 2 comments
Labels
upkeep maintenance, infrastructure, and similar

Comments

@mikemahoney218
Copy link
Member

Feature

Right now, passing anything that's truthy to na_rm will remove NA values, while values that can't be casted to logical crash in an if statement:

yardstick::rmse_vec(c(1, 3, NA), c(2, 5, 2), na_rm = 3)
#> [1] 1.581139
yardstick::rmse_vec(c(1, 3, 1), c(2, 5, 2), na_rm = "x")
#> Error in if (na_rm) {: argument is not interpretable as logical
yardstick::rmse_vec(c(1, 3, NA), c(2, 5, 2), na_rm = c(TRUE, FALSE))
#> Error in if (na_rm) {: the condition has length > 1

Created on 2022-12-10 by the reprex package (v2.0.1)

Would it be possible to check the type of na_rm before the if() statement?

@EmilHvitfeldt EmilHvitfeldt added the upkeep maintenance, infrastructure, and similar label Feb 8, 2023
@EmilHvitfeldt
Copy link
Member

This seems like a reasonable thing to do. Should properly live in the *_metric_summarizer() functions as a check_na_rm() call

@EmilHvitfeldt
Copy link
Member

related to #419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upkeep maintenance, infrastructure, and similar
Projects
None yet
Development

No branches or pull requests

2 participants