AS @dimitris_ps mentioned earlier, the answer could be:

do.call(rbind, listHolder)

Since do.call naturally "strips" 1 level of the "list of list", obtaining a list, not a list of lists.

After that, rbind can handle the elements on the list and create a matrix.

Answer from Camilo Abboud on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › r language › convert-list-of-lists-to-dataframe-in-r
Convert list of lists to dataframe in R - GeeksforGeeks
May 30, 2021 - Parameters: Where rbind is to convert list to dataframe by row and list_name is the input list which is list of lists
🌐
Reddit
reddit.com › r/rstats › converting list of lists into data frame
r/rstats on Reddit: Converting list of lists into data frame
November 7, 2018 -

I'm working with some large datasets in R consisting of Reddit comments for network analysis. A fairly small example file is available here: https://files.pushshift.io/reddit/comments/sample_data.json .

They're originally JSON files that are compressed, but I've been able to uncompress them, and to convert from JSON objects into R objects. But I'm now having trouble working with the data structure once it's in R. The file is a "large list", made up of 10000 smaller lists, and each smaller list is made up of 20 entries.

I want to convert the nested data to a tidy data frame, but can't quite figure out how to do it, and Google has not been able to solve my problem. Is there a command or script I should use to convert these multiple lists to a single data frame? Thanks for any help!

🌐
Rstats-tips
rstats-tips.net › 2021 › 02 › 07 › converting-lists-of-lists-of-lists-to-data-frames-or-tibbles
Converting Lists of Lists of Lists to Data.Frames (or Tibbles) - rstats-tips.net
February 7, 2021 - So use a version of all of these fantastic map-function from the purrr-package: (Read here for other fantastic stuff of purrr.) Look’s nice. But the original list consists of 5 rows. The result above is twice as long. So what happend? as_tibble generates for each entry of the list of the inner lists a row.
🌐
Reddit
reddit.com › r/rstats › how to convert a list of lists to one dataframe
r/rstats on Reddit: How to convert a list of lists to one dataframe
November 1, 2019 -

I created a list that contains 11356 nested list. I want to convert each of the 11356 to one dataframe with 11356 rows and 18 columns. Each of the 11356 list contains the same numbers of columns (18) (Image 1).

My problem is that some list are showing an error. (Image 2)

After the transformation in one dataframe I want to export this dataframe into excel.

I have read a lot of topics but still haven't found the right answer for my problem.

Top answer
1 of 1
3
In case you don't really need the variables MARKET, EXPRET and ABNRET for your further analysis the solution for this is pretty straight forward. You would just exclude those variables, and use bind_rows to get the data.frame. But since some variables contain more than a single value they make the code significantly more complex. I will provide example code, that should be easy to adjust to your data below for both scenarios. I am makinkg use of the map*() function family from the purrr package here that is very helpful for working with data nested in lists. You should make yourself familiar with it, if you aren't already. First I create some dummy data, that is a very condensed representation of your list, but it contains all problematic variants, that I spotted in your screenshots. And for both solutions we want to filter out all list entries that are error messages. l1 <- list( "ERROR", list(event = "6", ticker = "iur.de" ), list(event = "7", ticker = "mumu.uk", market = c(1,2,3), expret = c(2,3,4))) # This filters out all entries in the top level list, that are not a list # and will get rid of the error messages. l2 <- l1[map_lgl(l1, is.list)] Following is the easy solution, that excludes all variables that have more than one value. library(tidyverse) # This gets rid of the variables that are not single values (in your full data # that should be MARKET, EXPRET, ABNRET) l2b <- map(l2, ~.[map_lgl(., ~length(.) == 1)]) # And this creates the data.frame of all your list enties. bind_rows(l2b) And then, the complex solution, that doesn't drop any of your data. library(tidyverse) # This filters out all entries in the top level list, that are not a list # and will get rid of the Error messages. l2 <- l1[map_lgl(l1, is.list)] # This will create a data.frame of all the nested lists with repeated entries # for those variables that have more than one value (in your full data that should be # MARKET, EXPRET, ABNRET) df1 <- map_dfr(l2, as_tibble) # If you want to convert this to a data frame that contains just a single line # for each top level list entry you can do the following steps. This might be more # than you need though. # 1) create a nested column for those columns df2 <- nest(df1, nested_data = c(market, expret)) # 2) pivot/reshape/spread those values (this part is the most complex and there # might be a more elegant way to do this) # First we create a custom function for the pivoting, that can be applied to each # of the offending variables. custom_pivot_wider <- function(data, var_name) { mutate(data, tmp_id = 1:nrow(data)) %>% select(tmp_id, var_name) %>% pivot_wider(names_from = tmp_id, values_from = var_name, names_prefix = var_name) } # We apply the custom function to each variable and transform the results to a # single data frame. You want to add in the third variable here and adjust # the variable names. df3 <- map_dfr(df2$nested_data, ~bind_cols( custom_pivot_wider(., "market"), custom_pivot_wider(., "expret") )) # Finally we bind the dataframe containing the single values with the dataframe # containing the multi-value variables, that are now split into separate columns. df2 %>% select(-nested_data) %>% bind_cols(df3) # If your data doesn't contain three values for each entry of market, expret... # you might want to reorder the variables before binding the two data frames df2 %>% select(-nested_data) %>% bind_cols(df3[, order(names(df3))]) Let me know if it works! Edit: I added a few comments and realized that the complex version could probably be made a bit less complex by pasting the multi-value variables into a character variable and then separating it into three variables with dplyr's separate() command. That way the whole nesting and pivoting part could be avoided.
🌐
Statology
statology.org › home › how to convert a list to a data frame in r
How to Convert a List to a Data Frame in R
July 28, 2020 - #load library library(dplyr) #create list my_list <- list(a = list(var1 = 1, var2 = 2, var3 = 3), b = list(var1 = 4, var2 = 5, var3 = 6)) my_list $a $a$var1 [1] 1 $a$var2 [1] 2 $a$var3 [1] 3 $b $b$var1 [1] 4 $b$var2 [1] 5 $b$var3 [1] 6 #convert list to data frame bind_rows(my_list) # A tibble: 2 x 3 var1 var2 var3 1 1 2 3 2 4 5 6 · This results in a data frame with two rows and three columns. This method also tends to work faster than base R when you’re working with large datasets. ... Hey there. My name is Zach Bobbitt. I have a Masters of Science degree in Applied Statistics and I’ve worked on machine learning algorithms for professional businesses in both healthcare and retail.
🌐
Seaborn Line Plots
marsja.se › home › programming › how to convert a list to a dataframe in r – dplyr
How to Convert a List to a Dataframe in R - dplyr
March 17, 2025 - Moreover, we used the cbind function and, finally, the list we wanted to convert as the last argument. This will create a dataframe similar to the earlier ones. Now, you may wonder why we would like to do something like this. Well, we can use the rbind function instead of the cbind function.
Find elsewhere
Top answer
1 of 3
2

I couldn't reproduce your example, but what you're trying to do is simple. You could use do.call to call the rbind function on the list and what you get at the end is a pretty dataframe.

list <- getOptionChain("AAPL", "2019/2021")

data <- do.call(rbind, list)
2 of 3
1

It might be more flexible to work with a couple functions from dplyr and purrr. dplyr::bind_rows can take a list of data frames, and they can have different names, whereas the base rbind just works on 2 data frames at once. bind_rows also has an argument .id that will create a column of list item names. purrr::map_dfr calls a function over a list and returns a data frame of them all row-bound together; because it wraps around bind_rows, it also has an .id argument.

Having access to setting those IDs is helpful because you have 2 sets of IDs: one of dates, and one of calls vs puts. Setting one ID within the inner bind_rows and one within map_dfr gets both.

Written out with a function, to make it a little easier to see:

library(quantmod)
AAPL.2015 <- getOptionChain("AAPL", "2019/2021")

aapl_df <- purrr::map_dfr(AAPL.2015, function(d) {
  dplyr::bind_rows(d, .id = "type")
  }, .id = "date")

head(aapl_df)
#>          date  type Strike  Last   Chg   Bid   Ask Vol OI
#> 1 Sep.27.2019 calls    140 79.50  9.50 77.60 77.90  10 30
#> 2 Sep.27.2019 calls    145 75.85  0.00 72.70 73.30  NA 28
#> 3 Sep.27.2019 calls    150 72.22  0.00 67.85 67.90  10 91
#> 4 Sep.27.2019 calls    155 52.53  0.00 65.80 69.90  NA 10
#> 5 Sep.27.2019 calls    160 60.10  0.00 57.85 58.15   2 11
#> 6 Sep.27.2019 calls    165 54.40 15.95 52.65 52.90   9 16

Or in more common dplyr piping with function shorthand notation:

library(dplyr)
aapl_df <- AAPL.2015 %>%
  purrr::map_dfr(~bind_rows(., .id = "type"), .id = "date")
🌐
GeeksforGeeks
geeksforgeeks.org › r language › how-to-convert-a-list-to-a-dataframe-in-r
How to Convert a List to a Dataframe in R - GeeksforGeeks
July 23, 2025 - Data Viz. using R ... We have a list of values and if we want to Convert a List to a Dataframe within it, we can use a as.data.frame. it Convert a List to a Dataframe for each value. A DataFrame is a two-dimensional tabular data structure that can store different types of data.
🌐
GeeksforGeeks
geeksforgeeks.org › r language › convert-nested-lists-to-dataframe-in-r
Convert Nested Lists to Dataframe in R - GeeksforGeeks
November 15, 2021 - # list() functions are used to ... frame data_frame ... Method 2: To convert nested list to Data Frame by row. ... Create dataframe using data.frame function with the do.call and rbind....
🌐
Programiz
programiz.com › r › examples › convert-list-to-dataframe
R Program to Convert a List to a Dataframe
Created with over a decade of experience and thousands of feedback. ... # create a list list1 <- list(A = c("Sabby", "Cathy", "Dormy"), B = c(18, 24, 22), C = c("Computer Science", "Engineering", "Business") ) # convert list to dataframe result <- as.data.frame(list1) print(result)
🌐
sqlpey
sqlpey.com › r › r-list-to-dataframe-solutions
R: Multiple Efficient Methods to Convert an R List to a Data Frame
November 4, 2025 - Here, sapply attempts to build a matrix, and c converts the inner list into a vector before matrix assembly. The Reduce function can iteratively combine elements of a list using a specified function, such as rbind, before casting the final result to a data frame.
🌐
Rpkg
examples.rpkg.net › packages › serpstatr › reference › sst_lists_to_df.ob
R: Convert list of lists to data.frame
API response might contain nested lists with different number of elements. This function fills missing elements and combine lists to a data.frame.
🌐
CRAN
cran.r-project.org › web › packages › recombinator › recombinator.pdf pdf
Recombinate Nested Lists to Dataframes
If the list of lists is not formatted in this way, the function performs no error handling and will likely ... Turn nested lists into data.frames. ... A mini-utility package for turning nested lists into data.frames. A recombinator attempts to convert a depth 2 nested list into a data.frame.