list2DF
Quickly Make Data.frame From List of Vectors

Description

Makes a simple data.frame from a list of vectors without checking for valid names or column types.

Usage

list2DF(x = list(), nrow = NULL)

Arguments

x A list of vectors to become the columns of a data.frame. The vectors should have unique names, but this is not checked.
nrow The desired number of rows: all vectors in x are repeated or truncated to this length. If NULL, then it is set to the maximum of zero and the lengths of vectors in x.

Details

The vectors in x are passed through rep_len(x, nrow), and rep_len strips the attributes, includeing classes, from most things. It processes factors properly, but it converts objects such as Dates and POSIXct objects into numeric vectors, and it converts matrices into vectors.
If names(x) is NULL then the column names of the resulting data.frame are empty strings, "". Duplicate column names on a data.frame can confuse some functions.
Value
returns an nrow-row data.frame whose columns are derived from the vectors in x
See Also
data.frame, as.data.frame.
Examples
list2DF(list(One=1:3, Two=c("p","q","r")))
list2DF(list(One=1:3, Two=c("p","q")), nrow=5)
Package base version 6.0.0-69
Package Index