Description Usage Arguments Value Note Examples
This helper function recursively iterates through a "list-like" object and it
checks whether an element is of a given class. If it so, then it replaces
that element by the result of an execution of a given function. Otherwise,
and if the element is of length greater than 1 (i.e. not a scalar), it
replaces that element by the result of h_rapply(), recursively called for
that element. In the remaining case, that is, the element is not of a given
class and is a scalar, then that element remains unchanged.
1 |
x |
any "list-like" object for which subsetting operator |
fun |
( |
classes |
( |
... |
further arguments passed to function |
"list-like" object of similar structure as x.
This helper function is conceptually similar the same as rapply()
function. However, it differs from rapply() in two major ways. First, the
h_rapply() is not limited to objects of type list or expression only.
It can be any "list-like" object of any type for which subsetting operator
[[ is defined. This can be, for example, an object of type
language, often obtained from the body() function. The second
difference is that the flexibility of rapply() on how the result is
structured is not available with h_rapply() for the user. That is, with
h_rapply() each element of x, which has a class included in classes,
is replaced by the result of applying fun to the element. This behavior
corresponds to rapply() when invoked with fixed how = replace.
This function was primarily designed as a helper for h_jags_write_model()
function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.