I have a list like this:
l1 <- list(c("1", "A"), c("2", "B"), c("3", "C"))
and I want to create a dataframe out of it, where the first values of the respective lists are the values for the first column, and the second for the second column, so my desired output is:
col1 col2
-----------
1 A
2 B
3 C
However, When I do
data.frame(l1)
, I get the rows as columns:
col1 col2 col3
---------------
1 2 3
A B C
In the documentation for the data.frame
function, I was not able to find a respective parameter for this. How do I get the dataframe in the desired format?