time_interpolate: time_interpolate

Description Usage Arguments Value Author(s) See Also Examples

View source: R/time_interpolate.R

Description

Function to extrapolate missing years in MAgPIE objects.

Usage

1
2
3
4
5
6
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

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

magclass documentation built on Sept. 30, 2021, 5:06 p.m.