Skip to contents

Prepare data for a emission intensity plot

Usage

prep_emission_intensity(data, convert_label = identity, span_5yr = FALSE)

Arguments

data

A data frame. Requirements:

  • The structure must be like sda.

  • The column sector must have a single value (e.g. "cement").

  • (Optional) If present, the column label is used for data labels.

convert_label

A symbol. The unquoted name of a function to apply to y-axis labels. For example:

  • To convert labels to uppercase use convert_label = toupper.

  • To get the default behavior of qplot_emission_intensity() use convert_label = to_title.

span_5yr

Logical. Use TRUE to restrict the time span to 5 years from the start year (the default behavior of qplot_emission_intensity()), or use FALSE to impose no restriction.

Value

A data-frame ready to be plotted using plot_emission_intensity().

See also

Examples

# `data` must meet documented "Requirements"
data <- subset(sda, sector == "cement" & region == "global")
prep_emission_intensity(data)
#> # A tibble: 74 × 7
#>    sector year       region scenario_source emission_factor_metric
#>    <chr>  <date>     <chr>  <chr>           <chr>                 
#>  1 cement 2020-01-01 global demo_2020       projected             
#>  2 cement 2021-01-01 global demo_2020       projected             
#>  3 cement 2022-01-01 global demo_2020       projected             
#>  4 cement 2023-01-01 global demo_2020       projected             
#>  5 cement 2024-01-01 global demo_2020       projected             
#>  6 cement 2025-01-01 global demo_2020       projected             
#>  7 cement 2020-01-01 global demo_2020       corporate_economy     
#>  8 cement 2021-01-01 global demo_2020       corporate_economy     
#>  9 cement 2022-01-01 global demo_2020       corporate_economy     
#> 10 cement 2023-01-01 global demo_2020       corporate_economy     
#> # ℹ 64 more rows
#> # ℹ 2 more variables: emission_factor_value <dbl>, label <chr>