list_to_data.frame

0th

Percentile

Convert a list to a data frame

Converts a list to a data frame, with names in multiple columns.

Usage
list_to_data.frame(l, name_variables = "names", values_variable = "values", stringsAsFactors = getOption("stringsAsFactors"))
Arguments
l
A variable, probably a list.
name_variables
A string. What should the columns formed from the names of l be called?
values_variable
A string. What should the columns formed from the values of l be called?
stringsAsFactors
Should character columns be converted to factors?
Value

data.frame.

Aliases
  • list_to_data.frame
Examples
(l <- list(
  a = 1,
  2:3,                             # missing names are blank
  c = list(ca = 4:6, 7:10, list(cca = 11:15)),
  d = list()                       # empty elt's silently ignored
))
list_to_data.frame(l)

# Custom column names
list_to_data.frame(l, c("group", "subgroup", "element"), "amount")
Documentation reproduced from package listless, version 0.0-2, License: GPL-3

Community examples

Looks like there are no examples yet.