Another idea:
mylist = list(c(81, 72), c(81, 69), c(81, 79), c(81, 84)) f4 = function(x) { tlist = lapply(seq_along(x[[1]]), function(i) unlist(lapply(x, "[[", i))) structure(tlist, class = "data.frame", row.names = .set_row_names(as.integer(length(tlist[[1]]))), names = paste("col", seq_along(tlist), sep = "")) } f4(mylist) # col1 col2 #1 81 72 #2 81 69 #3 81 79 #4 81 84
And a test with other parameters:
library(stringi) f1 = function(x) setNames(as.data.frame(type.convert(stri_list2matrix(x, byrow = TRUE))), paste("col", seq_along(x[[1]]), sep = "")) f2 = function(x) setNames(do.call(rbind.data.frame, x), paste("col", seq_along(x[[1]]), sep = "")) f3 = function(x) setNames(as.data.frame(Reduce(rbind, lapply(x, t))), paste("col", seq_along(x[[1]]), sep = "")) myls = replicate(1e3, sample(1e2), simplify = F) identical(f1(myls), f2(myls))
source share