0

I have a list from a .json file that looks like this.

[[1]]
[1] list ()
[[2]] 
[1] integer(0)
[[3]]
[1] 0 9
[[4]]
[1] 3

I would like to transform this list into a data.frame that looks like this

column1 column2
  NA     NA 
  NA     NA
   0     9   
   3     NA

Any help would be appreciated

Sotos
  • 51,121
  • 6
  • 32
  • 66
LDT
  • 2,856
  • 2
  • 15
  • 32
  • You can try `library(plyr)` and `do.call(rbind.fill,yourlist)` – Duck Jul 06 '20 at 13:21
  • If your list is called `l1`, then try ```do.call(rbind, lapply(l1, `length<-`, max(lengths(l1))))``` or `t(stringi::stri_list2matrix(l1))` – Sotos Jul 06 '20 at 13:30

0 Answers0