prepare_for_timelineA: Prepares sda_target-type data for timeline plot

Description Usage Arguments Value Examples

View source: R/prepare_for_timeline.R

Description

Prepares sda_target-type data for timeline plot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
prepare_for_timelineA(
  sda_target_data,
  sector_filter = c("automotive", "aviation", "cement", "oil and gas", "shipping",
    "steel", "power"),
  year_start = 0,
  year_end = Inf,
  column_line_names = "emission_factor_metric",
  value_to_plot = "emission_factor_value",
  extrapolate_missing_values = FALSE
)

prepare_for_timelineB(data, extrapolate = FALSE)

Arguments

sector_filter

Sector to be used for filtering (character string of length 1). One of automotive, aviation, cement, oil and gas, shipping, steel, power)“'.

year_start

Start year of the plot (double).

year_end

End year of the plot (double).

column_line_names

Column specifying the names of lines to be plotted (character string).

value_to_plot

Column name of the value to be plotted (character string).

data, sda_target_data

Dataframe with columns sector, year and two other columns specifying value to be be plotted as timelines and line names (dataframe).

extrapolate, extrapolate_missing_values

Flag indicating if values should be extrapolated to match the furthest value in the data set.

Value

Dataframe with columns: year, line_name, value, extrapolated.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# prepare_for_timelineA() --------------------------------------------------

data <- sda_target
prepare_for_timelineA(
  data,
  sector_filter = "cement",
  year_start = 2020,
  year_end = 2050, column_line_names = "emission_factor_metric",
  value_to_plot = "emission_factor_value",
  extrapolate_missing_values = TRUE
)

# prepare_for_timelineA() --------------------------------------------------

data <- sda_target
tail(prepare_for_timelineB(data))
tail(prepare_for_timelineB(data, extrapolate = TRUE))

2DegreesInvesting/r2dii.plot.static documentation built on Dec. 17, 2021, 6:37 a.m.