I have a list of vectors in R:
[[1]]
[1] 1 2 3 4
[[2]]
[1] 7 9 1 4
[[3]]
[1] 8 2 1
[[4]]
[1] 8 9 0 7
And I want to make a dataframe
out of them. The problem is, I can't simply use unlist and then reorganize, because not all the vectors are the same length – I want NAs in my dataframe when that happens. The final result should look like this:
Col1 Col2 Col3 Col4
1 2 3 4
7 9 1 4
8 2 1 NA
8 9 0 7
Is there a way to do this?