get_vectors_from_nested_list: Return one or more values from a nested list in a list of...

View source: R/get_vectors_from_nested_list.R

get_vectors_from_nested_listR Documentation

Return one or more values from a nested list in a list of vectors

Description

Return one or more values from a nested list in a list of vectors

Usage

get_vectors_from_nested_list(x, valuesIn = NULL, nestingIn = "children")

Arguments

x

The nested list

valuesIn

The names holding the values to return (in vectors)

nestingIn

The name containing the nested lists

Value

A list of vectors.

Examples

nestedList <-
  list(
    id = "x",
    value = "value for x",
    children = list(
      list(
        id = "y",
        value = "value for y"
      ),
      list(
        id = "z",
        value = "value for z"
      )
    )
  );
str(nestedList);
get_vectors_from_nested_list(
  nestedList,
  c("id", "value")
);

rock documentation built on Dec. 28, 2022, 1:55 a.m.