Tibbles don't allow for duplicate column names at creation:
> data_frame(x = 1:2, x = 3:4)
Error: Column `x` must have a unique name
The _join functions throw informative errors when join key is duplicate and x is a regular data.frame
> x <- data.frame(x = 1:2, x = 3:4)
> colnames(x) <- c("x", "x")
> inner_join(x, data.frame(x = 1:2))
Error: Column `x` must have a unique name
However, via the same back door the column names of a tibble can get duplicated. When trying to join then the error is no longer informative.
> x <- data_frame(x = 1:2, x2 = 3:4 )
> colnames(x) <- c("x", "x")
> inner_join(x, data_frame(x = 1:2))
Joining, by = "x"
Error in inner_join_impl(x, y, by$x, by$y, suffix$x, suffix$y, check_na_matches(na_matches)) :
Column `` is unknown
If possible, I think the best option here is close the back door route and throw an error at the second line of the last code block. Otherwise an informative error seems desired.
Tibbles don't allow for duplicate column names at creation:
The
_joinfunctions throw informative errors when join key is duplicate and x is a regulardata.frameHowever, via the same back door the column names of a
tibblecan get duplicated. When trying to join then the error is no longer informative.If possible, I think the best option here is close the back door route and throw an error at the second line of the last code block. Otherwise an informative error seems desired.