list2DF: Create Data Frame From List

Description Usage Arguments Details Value See Also Examples

Description

Create a data frame from a list of variables.

Usage

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

Arguments

x

A list of variables for the data frame.

nrow

An integer giving the desired number of rows for the data frame, or NULL (default), in which case the maximal length of the elements of the list will be used. If necessary, list elements will be replicated to the same length given by the number of rows.

Details

Note that all list elements are taken “as is” (apart from possibly replicating to the same length).

Value

A data frame with the given variables.

See Also

data.frame

Examples

1
2
3
4
5
6
7
8
9
## 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)