I have a list
that contains 0-3 id numbers like this:
[[1]]
[1] 2125233 <NA> <NA>
[[2]]
[1] 2009281 2380145 2931851
[[3]]
[1] 1517163 2836702 2506119
How do I convert this to a data frame
where the element number becomes the id and the contents of the element becomes a string/factor like this:
id contents
1 2125233 <NA> <NA>
2 2009281 2380145 2931851
3 1517163 2836702 2506119
... .....
I've tried looking at unlist
but it just throws everything into one long vector.
Any suggestions?