set_list_path: Set a list value using path-style targeting

Description Usage Arguments Value Examples

View source: R/util.R

Description

Set a list value using path-style targeting

Usage

1
set_list_path(l, target, value)

Arguments

l

a list object

target

a character object specifying the "path" to the target.

value

an object or value to insert at the target location

Value

a list object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
l <- list(forest = list(country = "USA",
                        maple = list(height = 100)))

l <- set_list_path(l,
                   target = "/forest/spruce/height",
                   value = 30)

l <- set_list_path(l,
                   target = "/forest/maple/diameter",
                   value = 6)

l <- set_list_path(l,
                   target = "/valley/country",
                   value = "Canada")

AllenInstitute/BarMixer documentation built on Dec. 17, 2021, 8:42 a.m.