time_window: time_window

Description Usage Arguments Details Value

View source: R/time_window.R

Description

Calculates smoothed values for a dependent variable over different time windows

Usage

1
time_window(lags, df)

Arguments

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

Details

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

Value

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


bvidgen/RPackage documentation built on April 18, 2018, 8:26 p.m.