Skip to content

Combine lists into a data frame or append them to a text file

1 message · Ek Esawi

#
I tried Jim's function and it works. But here is an example just in case.

AA <- list(a=c(1,2,3,4),b = c("a","b","c"))
BB <- list(c=c(1,2,3,4,5),d=c("a","b","c","d","e"))
mylist <- (list(AA,BB))

lapply(mylist,function(x) write.table(x,file = test.txt))
 Show Traceback

 Error in (function (..., row.names = NULL, check.rows = FALSE,
check.names = TRUE,  :
  arguments imply differing number of rows: 4, 3
On Sun, Dec 16, 2018 at 8:45 AM Ek Esawi <esawiek at gmail.com> wrote: