I was wondering if there is an efficient way to convert each element (each with different length) in my List
to a column in a data frame to achieve my Desired_output
?
I tried the following without success:
dplyr::bind_cols(List)
Note: This data is toy, a functional answer is appreciated.
List <- list(`1000`=letters[1:2], `2000`=letters[1:3], `3000`=letters[1:4])
Desired_output <-
data.frame(`1000`= c(letters[1:2],"",""),
`2000`= c(letters[1:3],""),
`3000`= letters[1:4])