Description Usage Arguments Value Examples
Reduce a signal with its past values.
1 | reducePast(signal, fun, init)
|
signal |
A signal. |
fun |
An accumulator function. Should take two arguments |
init |
An initial value. |
A reactive of the same type as init
.
1 2 3 4 5 6 | # Simulate a markov random walk
walk <- reactive({fps(30); sample(c(-1, 0, 1), 1)})
location <- walk %>% reducePast(`+`, 0)
# Eventually:
# reactivePlot(count(walk), location)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.