| foldr | R Documentation |
Reduce .x with the two-argument function .f, associating from the right,
a thin wrapper around base::Reduce() with right = TRUE. With
.accumulate = TRUE the intermediate results are returned as well.
foldr(.x, .f, .init = NULL, .accumulate = FALSE, .simplify = TRUE)
.x |
A vector or list. |
.f |
A two-argument reducing function. |
.init |
Optional initial value. |
.accumulate |
Return intermediate accumulated values. |
.simplify |
Simplify accumulated results when possible. |
The folded value, or accumulated values when .accumulate = TRUE.
foldr(1:4, `+`)
foldr(letters[1:4], paste0, .accumulate = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.