Fix: only call replace_na(., 0)
on numeric columns
#195
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We are updating
tidyr::replace_na()
to utilize the vctrs package, and that results in slightly stricter / more correct type conversions. See tidyverse/tidyr#1219We noticed in revdeps that this package broke. An easy way to see this is by installing the above mentioned PR and running:
The problem boils down to the fact that you are calling
mutate_all(df, ~replace_na(., 0))
on adf
that has a mixture of character and numeric columns. Notably,PersonId
andgroup
are character columns, and you can no longer use a numeric0
as a replacement value for these.It seems like you probably just wanted to replace NAs in numeric columns, so this PR changes to a
mutate()
call that targets only numeric columns.We would greatly appreciate if you could merge this PR and submit a patch release of your package to CRAN so we can send tidyr in!