interpolate_choropleth: A Choropleth Interpolation Function

Description Usage Arguments Examples

View source: R/interpolate_choropleth.R

Description

While most interpolation functions are performed on "long" dataframes, this function performs interpolation of missing values on a choropleth style dataframe or any type of "wide" dataframe.

Usage

1
2
3
4
5
6
7
8
interpolate_choropleth(
  dataframe,
  name_key,
  start_year,
  end_year,
  time_intervals,
  interpolation_rule = 1
)

Arguments

dataframe

Specify the name of the dataframe that you'd like to interpolate.

name_key

Specify the column name (in quotes) that serves as the "key" for your dataframe. For a dataframe formatted in a "wide" choropleth style for EarthTime, this will often be the first column with the place names.

start_year

Specify the year the data begins. Due to the nature of the function, it is highly recommended that that date intervals are in years rather than days or months.

end_year

Specify the year the data ends. Due to the nature of the function, it is highly recommended that that date intervals are in years rather than days or months.

time_intervals

A vector of all the dataframe's time intervals that will be used as reference points for the interpolation function. Use, e.g., time_intervals = c(2002, 2007, 2011, 2013, 2019)

interpolation_rule

An integer (of length 0 or 1) describing how interpolation is to take place outside the interval (min(x), max(x)). If rule is 0 then NAs are returned for such points and if it is 1, the value at the closest data extreme is used. Defaults to 1.

Examples

1
2
3
4
## Not run: 
interpolated_df <- interpolate_choropleth(dataframe, name_key, start_year, end_year, time_intervals, interpolation_rule)

## End(Not run)

andrewcberkley/EarthTimeR documentation built on Dec. 19, 2021, 3:33 a.m.