Here is one way for you. If you have all the listings in your global environment, you can do the following. First you create a list with all the lists you have. Then you use transpose() , which allows you to create a list for each person (for example, a list for Bob with rating and comments). In each list, you have comments and ratings as nested lists in this case. You want to list them in each list. For this reason, you can use rapply2() by rawr. Finally, you create a data frame for each list.
library(magrittr) library(purrr) library(rawr) #devtools::install_github('raredd/rawr') score <- list(Bob = list(c('1'), ('0')), Jane = list(c('1'), ('2'), ('4'), ('2'))) comments <- list(Bob = list(c('AAA'), ('BBB')), Jane = list(c('ZZZ'), ('XXX'), ('YYY'), ('QQQ'))) # Get all objects in the global environment and create a list. mylist <- mget(ls(pattern = ".*")) purrr::transpose(mylist) %>% rapply2(unlist, classes = "list") %>% lapply(as.data.frame, stringsAsFactors = FALSE) $Bob comments score 1 AAA 1 2 BBB 0 $Jane comments score 1 ZZZ 1 2 XXX 2 3 YYY 4 4 QQQ 2
source share