Learn R Programming

carbonr (version 0.2.7)

plastic_emissions: Calculate plastic emissions

Description

Computes embodied GHG emissions for plastics using uk_gov_data rows with Level 2 = "Plastic". Material-use factors come from Level 1 = "Material use", Column Text = "Primary material production". Waste factors come from Level 1 = "Waste disposal", Column Text = waste_disposal. Factors are assumed kg CO2e per tonne (UOM = tonne, GHG/Unit = kg CO2e).

Usage

plastic_emissions(
  use = stats::setNames(numeric(), character()),
  waste = TRUE,
  waste_disposal = c("Landfill", "Open-loop", "Closed-loop", "Combustion"),
  units = c("kg", "tonnes"),
  value_col = c("value", "value_2024"),
  strict = TRUE
)

Value

Numeric total emissions in requested units.

Arguments

use

Named numeric vector of plastic quantities in tonnes. Names are matched (case/space/punctuation-insensitive) to Level 3 after normalisation that also:

  1. removes any prefix up to ": " (e.g., "Plastics: HDPE" is "HDPE"), and

  2. strips any trailing parenthetical (e.g., "HDPE (bottles)" is "HDPE"). Accepted types: average, average_film, average_rigid, hdpe, ldpe, lldpe, pet, pp, ps, pvc. Unknown names are ignored (treated as zero).

waste

Logical. If TRUE, the same tonnages as use are sent to the chosen waste route. If FALSE, no waste is applied.

waste_disposal

One of "Landfill", "Open-loop", "Closed-loop", or "Combustion". Applied to all waste. If a plastic lacks a factor for the chosen route, behaviour depends on strict.

units

Output units: "kg" (default) or "tonnes".

value_col

Which numeric column to use in uk_gov_data: "value" or "value_2024".

strict

If TRUE (default), error when any nonzero use or implied waste requires a factor that is absent in the table. If FALSE, treat missing factors as zero.

Details

Material use: Plastics generally use "Primary material production" as the Column Text. This function always uses that for material-use factors.

Waste disposal: Factors are taken from the specified waste_disposal route. Availability varies by plastic type and year; this is enforced by the presence/absence of rows in uk_gov_data. Missing pairs error under strict = TRUE or contribute zero under strict = FALSE.

Units: Factors are kg CO2e per tonne; if units = "tonnes", the total is divided by 1000.

Examples

Run this code
# 1) Basic: primary material production + landfill; waste tonnage = use
plastic_emissions(
  use = c(average_plastics = 100, hdpe = 50, pet = 25),  # tonnes
  waste_disposal = "Landfill",
  waste = TRUE,
  units = "kg"
)

# 2) Choose 2024 factors and report in tonnes; no waste applied
plastic_emissions(
  use = c(average_plastic_film = 10, average_plastic_rigid = 5, pp = 2),
  waste_disposal = "Closed-loop",
  waste = FALSE,
  value_col = "value_2024",
  units = "tonnes"
)

# 3) Strict behaviour: error if a required waste route is unavailable
if (FALSE) {
plastic_emissions(
  use = c(ps = 1),
  waste_disposal = "Combustion",
  waste = TRUE,
  strict = TRUE
)}
# Tolerant: treat missing waste factors as 0
plastic_emissions(
  use = c(ps = 1),
  waste_disposal = "Combustion",
  waste = TRUE,
  strict = FALSE
)

Run the code above in your browser using DataLab