Description Usage Arguments Value
Create a sliding window iterator generator
1 | carry_forward_window_gen(sorted_times, interval, skip = 1)
|
sorted_times |
a vector of date-times in ascending order. |
interval |
a time interval. The default is minutes(5). |
skip |
elements on the interval. |
an iterator that, when called with nextElem returns the indices in the next window. If there is only one value in the window the last valid index is returned as the first. This allows for carrying prices forward when transactions are sparse in time. data(aapl_fix) aapl_fix$dt_string = paste(aapl_fix$sys_date, aapl_fix$sys_time) aapl_fix$dt = strptime(aapl_fix$dt_string, " it = carry_forward_window_gen(aapl_fix$dt) window1 = nextElem(it) aapl_fix$dt[c(window1[1], tail(window1, 1)] window2 = nextElem(it) aapl_fix$dt[c(window2[1], tail(window2, 1)]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.