Summarise the structure of a list

Share:

Description

Summarise the structure of a list, in a tidy data frame.

Usage

1
2
list_str(l, name_variables = "names",
  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?

stringsAsFactors

Should character columns be converted to factors?

Value

data.frame.

See Also

str, list_to_data.frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
l <- list(
  a = 1,
  b = matrix(1:6, 2),
  c = list(
    ca = y ~ x,
    list(cba = median, cbb = quote(1 + 1), cbc = expression(1 + 1)),
    cc = list(cca = as.name("xyz"))
  ),
  d = array(1:24, 2:4)
)
list_str(l)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.