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

Allow multiple arguments to na_if #7652

Closed
nalimilan opened this issue Feb 4, 2025 · 1 comment
Closed

Allow multiple arguments to na_if #7652

nalimilan opened this issue Feb 4, 2025 · 1 comment

Comments

@nalimilan
Copy link

It's quite frequent to have to recode several distinct values to NA. So far the shortest solution I could find to do that is e.g. na_if(na_if(vec, 88), 99). if_else(vec %in% c(88, 99), NA_real_, vec) or case_match(vec, c(88, 99) ~ NA, .default=vec) are also possible but relatively verbose. Could it be allowed to pass multiple arguments to na_if so that one could write na_if(vec, 88, 99) instead?

@hadley
Copy link
Member

hadley commented Feb 18, 2025

Duplicate of #7651

@hadley hadley marked this as a duplicate of #7651 Feb 18, 2025
@hadley hadley closed this as completed Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants