Description Usage Arguments Details Note
View source: R/event_distance.R
Distance from each event to nearest non-event
1 2 | event_distance(x, positions = seq_along(x), event_value = 1,
keep_sign = FALSE)
|
x |
vector of values indicating events (and arbitrary values indicating non-events) |
positions |
indicating locations separating distance between values in |
event_value |
value in |
keep_sign |
Logical; should distances retain their sign? See Note |
Finds whether each value in a streak (run) is closer to the beginning or the end of the streak, and then finds the distance to whichever is nearest.
When keep_sign
is TRUE, the sign of values equidistant from 2 non-events may be misleading: even though the event is not closer to either, the sign will be negative.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.