exposure_lag: Calculate Individual and Cumulative Lags for Exposure
Description
Calculate individual and cumulative lag exposure for specific variables. Cumulative lag exposure was calculated by using moving average.
Usage
exposure_lag(data,var,maxlag,ID,Date,lag_suffix)
Value
It returns a dataframe with calculated individual and cumulative lag exposures. 'var_cu_lag5' means the moving average from lag 0 to lag 5 days. 'var_si_lag5' means the exposure 5 days ago.
Arguments
data
A dataframe.
var
Variable names in the dataframe to specify variables to be used for the lag calculation.
maxlag
A number. The max day for calculating the lag exposure.
ID
A variable name. The exposure station ID.
Date
A variable name. A variable indicating the date of exposure measurement.
lag_suffix
A two-length vector indicating the cumulative lag or the individual lag. The first was the suffix for cumulative lag exposure. The second was for individual lag exposure. Default: c('_cu_lag','_si_lag')
References
Deng X, Friedman S, Ryan I, et al. The independent and synergistic impacts of power outages and floods on hospital admissions for multiple diseases [published online ahead of print, 2022 Mar 5]. Sci Total Environ. 2022;828:154305. doi:10.1016/j.scitotenv.2022.154305