0

I got a list of 26 elements. I need to use map() and inner_join() to get the duplicated row value among the elements. I want to compare the elements by pair and inner_join the random two elements by "name". split is the list.

here is an example. I split the mtcars into a list with 3 elements. I want to use map() and inner_join to compare them in pairs. I want to find a more efficient way to do inner_join among elements.

mtcars
unique(mtcars$gear)
mtcars %>% 
    group_by(gear) %>% 
    group_split()->split_gear

inner_join(split_gear[[1]],split_gear[[2]])
inner_join(split_gear[[1]],split_gear[[3]])
inner_join(split_gear[[2]],split_gear[[3]])

name<-list()
for (a in 1:26){
  a_for<-split %>% 
    map_df(~.[a, 8])
  b_for<-split %>% 
    map_df(~.[a+1, 8])
  name[[a]]<-inner_join(a_for,b_for, by ="name")
}
  • Please make a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) or [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) with a sample input and your expected output. This is needed to create, test and verify possible solutions. – Martin Gal Nov 14 '21 at 14:23

0 Answers0