time_interpolate: time_interpolate

View source: R/time_interpolate.R

time_interpolateR Documentation

time_interpolate

Description

Function to extrapolate missing years in MAgPIE objects.

Usage

time_interpolate(
  dataset,
  interpolated_year,
  integrate_interpolated_years = FALSE,
  extrapolation_type = "linear"
)

Arguments

dataset

An MAgPIE object

interpolated_year

Vector of years, of which values are required. Can be in the formats 1999 or y1999.

integrate_interpolated_years

FALSE returns only the dataset of the interpolated year, TRUE returns the whole dataset, including all years of data and the itnerpolated year

extrapolation_type

Determines what happens if extrapolation is required, i.e. if a requested year lies outside the range of years in dataset. Specify "linear" for a linear extrapolation. "constant" uses the value from dataset closest in time to the requested year.

Value

Uses linear extrapolation to estimate the values of the interpolated year, using the values of the two surrounding years. If the value is before or after the years in data, the two closest neighbours are used for extrapolation.

Author(s)

Benjamin Bodirsky, Jan Philipp Dietrich

See Also

convergence

Examples


p <- maxample("pop")
time_interpolate(p, "y2000", integrate = TRUE)
time_interpolate(p, c("y1980", "y2000"), integrate = TRUE, extrapolation_type = "constant")

magclass documentation built on May 29, 2024, 6:20 a.m.