[Solved] Frequency table with common values of 5 tables


Here’s my solution using purrr & dplyr:

library(purrr)
library(dplyr)

lst1 <- list(mtcars=mtcars, iris=iris, chick=chickwts, cars=cars, airqual=airquality)  

lst1 %>%
  map_dfr(select, value=1, .id="df") %>%                # select first column of every dataframe and name it "value"
  group_by(value) %>% 
  summarise(freq=n(),                                   # frequency over all dataframes
            n_df=n_distinct(df),                        # number of dataframes this value ocurrs
            dfs = paste(unique(df), collapse=",")) %>% 
  filter(n_df > 1) %>% 
  filter(n_df == 5)                                     # if value has to be in all 5 dataframes

solved Frequency table with common values of 5 tables