approx_fun: approx_fun

View source: R/common.R

approx_funR Documentation

approx_fun

Description

approx (interpolation) for interpolating years in a dplyr pipeline.

Usage

approx_fun(year, value, rule = 1)

Arguments

year

Numeric year, in a melted (gathered) data frame

value

Numeric value to interpolate

rule

Rule to use; see approx and details

Details

Rule=1: interpolate only; out of bounds -> missing values Rule=2: out of bounds -> fixed extrapolation

Value

Interpolated values.

Examples

df <- data.frame(year = 1:5, value = c(1, 2, NA, 4, 5))
approx_fun(df$year, df$value, rule = 2)

transportenergy/item_mip_data_processing documentation built on July 6, 2023, 7:51 p.m.