Description Usage Arguments Details Value

Calculates smoothed values for a dependent variable over different time windows

1 | ```
time_window(lags, df)
``` |

`lags` |
a vector of time periods for the dependent to be smoothed over. Periods are based on the unit of the first column in the dataframe i.e. if the first column is days then express the lag window in days (7,30,90 are recommended) or if it is in hours then express in hours (24 or 168 are recommended) |

`df` |
a dataframe where the first column is the time variable, and the second column is the dependent variable |

the smoothed depndent variable value is calculated in the middle of the time window; i.e. if the window is 24 hours then the dependent variable will smooth over the previous 12 hours and the following 12 hours

a 'long' dataframe with three columns; (1) the time variable, (2) the smoothed dependent variable, and (3) the time window

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.