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

boxcox_trans() does not work with missing values. #181

Closed
sflippl opened this issue Sep 10, 2018 · 1 comment
Closed

boxcox_trans() does not work with missing values. #181

sflippl opened this issue Sep 10, 2018 · 1 comment

Comments

@sflippl
Copy link
Contributor

sflippl commented Sep 10, 2018

In the presence of missing values, boxcox_trans does not work:

trans <- scales::boxcox_trans(p = 0)
# This works:
trans$trans(1:3)
# This does not work:
trans$trans(c(1:3, NA_real_))

The issue is with the if clause. Because any(c(1:3, NA_real_) > 0) returns NA, the condition cannot be evaluated. Adding na.rm = TRUE should fix it. I'm happy to modify the R and the test file if that is helpful.

@hadley
Copy link
Member

hadley commented Sep 10, 2018

Yes, please, a PR would be great.

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