To turn a list into a table in R, we can use the data.frame
function. Here's an example:
main.r272 chars11 lines
This will output:
main.r108 chars5 lines
Note that in this example, each element of the list became a column in the resulting data frame. If the elements of the list do not have the same length, R will show a warning and recycle the values to make them the same length. To avoid this, it's important to ensure that all the elements of the list have the same length, or that they are of the same data type.
gistlibby LogSnag