Description Usage Arguments Value Examples
View source: R/ts_event_dist.R
Given a dummy coded (0
for non-event and 1
for event)
timeseries, determine the number of periods (vector elements) until the next,
and since the last event.
1 2 3 4 5 | ts_next_in(x)
ts_last_before(x)
ts_event_dist(x)
|
x |
A numeric vector of |
ts_next_in
and ts_last_before
return a numeric vector
of length(x)
.
ts_event_dist
returns a data.frame
with columns
last_before
and next_in
, and length(x)
rows.
1 2 3 | ts_next_in(c(0, 0, 0, 1, 0, 1, 0))
ts_last_before(c(0, 0, 0, 1, 0, 1, 0))
ts_event_dist(c(0, 0, 0, 1, 0, 1, 0))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.