findEntry.RdfindEntry searches recursive objects for components
matching a condition.  namePattern creates a test of
whether the component name matches a pattern.  hasClass
creates a test of whether the component has a class.
findEntry(x, test, ..., path = c())
namePattern(pattern)
hasClass(class)The recursive object to search.
A test function. See Details below.
A regexp pattern to match the desired name(s).
A class name to search for.
Optional additional arguments to pass to the test function.
For internal use: names to prepend to the path.
Utility/debugging functions to search a large recursive object for a particular component name or class.
The test function should have header function(name, value), and may include other arguments which will
be taken from ....
findEntry returns
a list with one entry per hit.  Each entry in the list is a named vector
giving the path to the hit, numerically in the values, and as an R expression
by concatenating the names.  The test functions will be passed
single names and values, and should return a single logical result.
x <- list( a = list( b = list(c(d="A", e="B"), 1L, 1:3)))
locations <- findEntry(x, namePattern("e"))
locations
#> [[1]]
#>    $a    $b [[1]] ['e'] 
#>     1     1     1     2 
#> 
#This shows how the result can be used:
x[[locations[[1]]]]
#> [1] "B"
expr <- paste0(c("x", names(locations[[1]])), collapse = "")
expr
#> [1] "x$a$b[[1]]['e']"
eval(parse(text=expr))
#>   e 
#> "B" 
findEntry(x, hasClass("integer"))
#> [[1]]
#>    $a    $b [[2]] 
#>     1     1     2 
#> 
#> [[2]]
#>    $a    $b [[3]] 
#>     1     1     3 
#>