approx
(interpolation) for use in a dplyr pipeline.
approx_fun(year, value, rule = 1)
Numeric year, in a melted tibble or data frame
Numeric value to interpolate
Rule to use; see approx
and details
Interpolated values.
This was gcam_interp
in the original data system.
df <- data.frame(year = 1:5, value = c(1, 2, NA, 4, 5))
approx_fun(df$year, df$value, rule = 2)
#> [1] 1 2 3 4 5