View source: R/retrieve_and_has.R
retrieve | R Documentation |
get
in JavaScriptThis is a handy function for retrieving items deep in a nested structure without causing error if not found
retrieve(sourceList, path, default = NA)
sourceList |
The |
path |
A string that can be separated by [,] or ., the string |
default |
The value to return if the element isn't found |
Returns a sub-element from sourceList
or the default
value.
Other lodash similar functions:
has()
source <- list(a = list(b = 1, `odd.name` = 'I hate . in names', c(1,2,3)))
retrieve(source, "a.b")
retrieve(source, "a.b.1")
retrieve(source, "a.odd\\.name")
retrieve(source, "a.not_in_list")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.