Suppose I have two tibbles: a and b.
a <- tibble("unordered_characters" = list( c("A","B"), c("X","Y") ) ,
"v" = c("G", "F"))
b <- tibble("unordered_characters" = list( c("B","A"), c("Y","X")),
"x" = c("M", "d"))
I want to join b on a using their common variable, which is a list. But I want the list to be unordered, so that c("A","B") should be the same as c("B","A").
In other words, setequal(c("A","B"),c("B","A")) returns TRUE. This would to create the following table:
unordered_characters v x
------------------------
c("A","B") G M
c("X","Y") F d
But a %>% left_join(b) results in the following:
unordered_characters v x
------------------------
c("A","B") G NA
c("X","Y") F NA
How can I fix this?