I am searching for the Tidyverse way of converting a list of lists to a dataframe in R.
# Create a list of lists:
a <- seq(1,10,1)
b <- seq(1,20,2)
# Function to calculate the sum
# (just an example, I am aware of the base R sum())
sum_test <- function(a=a, b=b){
sum <- a+b
df <- cbind(a,b,sum)
return(df)
}
list_of_lists <- purrr::map2(a,b,sum_test)
Non-tidyverse way to create a dataframe of the list of lists:
df <- as.data.frame(do.call(rbind, list_of_lists))
Question
How to convert a list of lists to a dataframe using tidyverse (with and without a pipe)?