nav: navigate list/env function

Description Usage Arguments Examples

View source: R/routines.R

Description

navigate a list or environment object untile the very leaf, given a path

Usage

1
nav(path_vect,current_node)

Arguments

path

a vector of characters with the exact names of the list/env nodes to follow, in the right order (from root) the behaviour of this function is unpredictable in the connect-graphs scenario, meaning a child not is also a ancestor of itself

current_node

the first node to start iteration from, if it's the root of your list/environment, then current_node(path[1]) will be current_node in the second iteration this means that you need to adapt the path argument to the current_node. e.g. path[-1] when starting from second node.

Examples

1
2
list(first=list(second=list(three=list(four=c("hello world"))))) -> listA
nav(c("first","second","three","four"),listA)

Davz33/lazykitten documentation built on Jan. 28, 2022, 1:56 a.m.