Skip to content

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

@hadley

Description

@hadley
Member
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)

Activity

hadley

hadley commented on May 4, 2020

@hadley
MemberAuthor

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

added a commit that references this issue on May 4, 2020
afda5ea
added a commit that references this issue on May 11, 2020
2c04355
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorverbs 🏃‍♀️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @hadley

      Issue actions

        df_patch (via coalesce) is too picky about types · Issue #5186 · tidyverse/dplyr