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

df_patch (via coalesce) is too picky about types #5186

Closed
hadley opened this issue May 4, 2020 · 1 comment · Fixed by #5187
Closed

df_patch (via coalesce) is too picky about types #5186

hadley opened this issue May 4, 2020 · 1 comment · Fixed by #5187
Labels
bug verbs 🏃‍♀️

Comments

@hadley
Copy link
Member

hadley commented May 4, 2020

library(dplyr, warn.conflicts = FALSE)

df <- tibble(a = 1:3, b = letters[c(1:2, NA)], c = 0.5 + 0:2)
df %>% rows_patch(tibble(a = 2:3, b = "B"))
#> Matching, by = "a"
#> # A tibble: 3 x 3
#>       a b         c
#>   <int> <chr> <dbl>
#> 1     1 a       0.5
#> 2     2 b       1.5
#> 3     3 B       2.5
df %>% rows_patch(tibble(a = c(2, 3), b = "B"))
#> Matching, by = "a"
#> Error: Argument 2 must be an integer vector, not a double vector

Created on 2020-05-04 by the reprex package (v0.3.0)

@hadley hadley added bug verbs 🏃‍♀️ labels May 4, 2020
@hadley
Copy link
Member Author

hadley commented May 4, 2020

One quick hack would be to use vec_ptype_common() in coalesce() and leave replace_with() as is.

hadley added a commit that referenced this issue May 4, 2020
hadley added a commit that referenced this issue May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug verbs 🏃‍♀️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant