0

I want to convert my list into a dataframe. Please see the attached image of how my list looks like.

I tried using

do.call(cbind, lapply(mylist, as.data.frame))

https://ibb.co/BNC06hv

neilfws
  • 32,751
  • 5
  • 50
  • 63
  • Please include a small [reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) example of the data in `mylist` as plain text, not as an image, so users can copy/paste it easily. – neilfws Jun 11 '19 at 22:20
  • If you have substantially different lengths, you're probably best off with a long-form dataset that has a column for the list name and a column for the values. E.g. using `mylist <- list(a=letters[1], b=letters[1:5], c=NULL, d=letters[1:3])` try `stack(mylist)` – thelatemail Jun 11 '19 at 22:36

0 Answers0