Linearly interpolate missing data in-between dates with observed data
Source:R/ffp_ppts_interp.R
ff_ppts_interp_linear.Rd
A file, df_data
, has grouping variables ar_svr_group
and a data variable svr_data
(e.g., population), measured at sequential
svr_date
(e.g., year, month) dates. There are nonconsecutive gaps in svr_data
measurements, with missing values in some dates. We use the rate of change
between the closest dates in which there is data to linearly interpolate
svr_data
in dates with missing values. The output is stored in variable
svr_interp
.
Arguments
- df_data
data frame with various time-series/panel with missing data
- ar_svr_group
array of grouping variable names, panel groups
- svr_data
string variable name for data variable
- svr_date
string variable name for date variable
- svr_interp
string variable name for variable with interpolated values
- verbose
Boolean print details
Author
Fan Wang, http://fanwangecon.github.io