Skip to content

left_join() error message names wrong variable in y #6465

Description

@cjyetman

When joining two tables by differently named columns, if they are incompatible types the error message uses the name of the by column in table x as the name of the by column in table y, e.g. y$var1 which does not exist in the example below.

library(dplyr)

tb1 <-
  tibble(
    var1 = 1,
    value = 2
  )

tb2 <-
  tibble(
    id1 = "1",
    value = 2
  )

left_join(tb1, tb2, by = c(var1 = "id1"))
#> Error in `left_join()`:
#> ! Can't join on `x$var1` x `y$var1` because of incompatible types.
#> ℹ `x$var1` is of type <double>>.
#> ℹ `y$var1` is of type <character>>.

using:
R version 4.2.1
dplyr 1.0.10
rlang 1.0.5
cli 3.4.0

Metadata

Metadata

Assignees

Labels

bugan unexpected problem or unintended behaviortables 🧮joins and set operations

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions