list2DF {base} | R Documentation |
Create a data frame from a list of variables.
list2DF(x = list(), nrow = 0)
x |
A list of same-length variables for the data frame. |
nrow |
An integer giving the desired number of rows for the data frame in
case |
Note that all list elements are taken “as is”.
A data frame with the given variables.
## Create a data frame holding a list of character vectors and the
## corresponding lengths:
x <- list(character(), "A", c("B", "C"))
n <- lengths(x)
list2DF(list(x = x, n = n))
## Create data frames with no variables and the desired number of rows:
list2DF()
list2DF(nrow = 3L)