View source: R/list_manipulation.R
Given a list .x, this function looks to see if the field .field is defined within that list. If it is defined, the value for that entry is returned. If .field is not defined, then the function either returns the value .default_val or the value .default_fn(.field). The latter is lazily evaluated, ie, it's only computed if .field is not in .x.
1 | get_or_else(.x, .field, .default_val, .default_fn)
|
.x |
A list |
.field |
A string. This may or may not be one of the names in the list .x; if it is the associated value is returned. If not either .default_val or .default_fn(.field) is returned. |
.default_val |
A value that is to be returned if .field is not in .x. Only one of .default_val and .default_fn may be defined. |
.default_fn |
A single argument function that is evaluated if .field is not in .x. The value .field is passed into this function as an argument. Only one of .default_val and .default_fn may be defined. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.