Reduce from the right (retired)Source:
These functions were deprecated in purrr 0.3.0. Please use the
.dir argument of
reduce() instead, or reverse your vectors
and use a left reduction.
reduce_right(.x, .f, ..., .init) reduce2_right(.x, .y, .f, ..., .init) accumulate_right(.x, .f, ..., .init)
A list or atomic vector.
reduce(), a 2-argument function. The function will be passed the accumulated value as the first argument and the "next" value as the second argument.
reduce2(), a 3-argument function. The function will be passed the accumulated value as the first argument, the next value of
.xas the second argument, and the next value of
.yas the third argument.
The reduction terminates early if
.freturns a value wrapped in a
Additional arguments passed on to the mapped function.
We now generally recommend against using
...to pass additional (constant) arguments to
.f. Instead use a shorthand anonymous function:
This makes it easier to understand which arguments belong to which function and will tend to yield better error messages.
If supplied, will be used as the first value to start the accumulation, rather than using
.x[]. This is useful if you want to ensure that
reducereturns a correct value when
.xis empty. If missing, and
.xis empty, will throw an error.