Convert Mixed-Length named List to data.frame

前端 未结 6 1528
夕颜
夕颜 2020-12-31 04:52

I have a list of the following format:

[[1]]
[[1]]$a
[1] 1

[[1]]$b
[1] 3

[[1]]$c
[1] 5

[[2]]       
[[2]]$c
[1] 2

[[2]]$a
[1] 3

There i

6条回答
  •  遥遥无期
    2020-12-31 05:23

    Here is a short answer, I doubt it will be very fast though.

    > library(plyr)
    > rbind.fill(lapply(x, as.data.frame))
      a  b c
     1 1  3 5
     2 3 NA 2
    

提交回复
热议问题