In R's inner_join function, the parameter by is documented as "a character vector of variables to join by".
The two sample tables are as follows
tb1 <- data.frame(var1 = c(1,3,8,4,2), "var2"=c(-1.1,3.3,4.2,2.3,-3.2), key=c("a","c","b","c","a"))
tb1
tb2 <- data.frame(key=c("a","b","c"),var3=c("Ada","Byron","Cleopatra"))
tb2
So, I tried both equivalent methods. The two (supposedly equivalent) methods I tried are:
(1)
key= c("a","c","b","c","a")
inner_join(tb1,tb2,by="key")
(2)
inner_join(tb1,tb2,by=c("a","c","b","c","a"))
The (2) method produces an error
Error: Join columns must be unique. x Problem at position 4 and 5.
Both are character vectors. What did I understand wrongly?