Learn R Programming

carbonr (version 0.2.7)

material_emissions: Material (and waste) emissions — vector-first wrapper

Description

Convenience wrapper that sums emissions from paper, plastics, metals, electrical items, construction materials, glass, and industrial waste. It forwards to the dedicated calculators: paper_emissions(), plastic_emissions(), metal_emissions(), electrical_emissions(), and construction_emissions().

Usage

material_emissions(
  paper_use = stats::setNames(numeric(), character()),
  plastic_use = stats::setNames(numeric(), character()),
  metal_use = stats::setNames(numeric(), character()),
  electrical_use = stats::setNames(numeric(), character()),
  construction_use = stats::setNames(numeric(), character()),
  paper_waste = TRUE,
  plastic_waste = TRUE,
  metal_waste = TRUE,
  electrical_waste = TRUE,
  construction_waste = TRUE,
  paper_material_production = "Primary material production",
  metal_material_production = "Primary material production",
  construction_material_production = "Primary material production",
  paper_waste_disposal = c("Closed-loop", "Combustion", "Composting", "Landfill"),
  plastic_waste_disposal = c("Landfill", "Open-loop", "Closed-loop", "Combustion"),
  metal_waste_disposal = c("Closed-loop", "Combustion", "Landfill", "Open-loop"),
  electrical_waste_disposal = c("Landfill", "Open-loop"),
  construction_waste_disposal = c("Closed-loop", "Combustion", "Composting", "Landfill",
    "Open-loop"),
  glass = 0,
  glass_waste = TRUE,
  glass_waste_disposal = c("Closed-loop", "Combustion", "Landfill", "Open-loop"),
  industrial_waste = 0,
  industrial_waste_disposal = c("Combustion", "Landfill"),
  units = c("kg", "tonnes"),
  value_col = c("value", "value_2024"),
  strict = TRUE
)

Value

Total emissions in the requested units.

Arguments

paper_use, plastic_use, metal_use, electrical_use, construction_use

Named numeric vectors of quantities in tonnes (defaults empty).

paper_waste, plastic_waste, metal_waste, electrical_waste, construction_waste, glass_waste

Logical flags: if TRUE, apply waste factors to the same tonnages as use.

paper_material_production, metal_material_production, construction_material_production

Either a single string (applied to all materials) or a named vector per material. Common values: "Primary material production", "Closed-loop source", "Closed-loop", "Open-loop", "Combustion", "Landfill" (availability depends on the table).

paper_waste_disposal, plastic_waste_disposal, metal_waste_disposal, electrical_waste_disposal, construction_waste_disposal, glass_waste_disposal

Waste route to use for the family. See the calculators' docs for valid choices. (Electrical typically: "Landfill", "Open-loop"; Construction supports "Closed-loop", "Combustion", "Composting", "Landfill", "Open-loop" with material-specific availability.)

glass

Numeric tonnage of glass (material use).

industrial_waste

Numeric tonnage of commercial and industrial waste (end-of-life only).

industrial_waste_disposal

"Combustion" or "Landfill".

units

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

value_col

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

strict

If TRUE (default), error when a required factor is missing; if FALSE, treat missing factors as 0.

Canonical names (examples)

  • Paper: board, mixed, paper

  • Plastics: average, average_film, average_rigid, hdpe, ldpe, lldpe, pet, pp, ps, pvc

  • Metals: aluminium (cans/foil), mixed_cans, scrap, steel_cans

  • Electrical: fridges, freezers, large_electrical, it, small_electrical, alkaline_batteries, liion_batteries, nimh_batteries

  • Construction: use the material names supported by construction_emissions()

Backwards compatibility

Legacy scalar arguments (e.g. board, HDPE, fridges, aluminuim_cans, …) are still accepted and are added into the corresponding *_use vectors. Legacy *_WD arguments (separate waste tonnages) are deprecated and ignored; supply *_waste = TRUE instead.

Details

For each family you provide a named use vector in tonnes plus a waste = TRUE/FALSE flag (waste tonnage equals use when TRUE). Unknown names are ignored by the underlying calculators (with warnings).

Examples

Run this code
# Paper + Metals + Glass, with waste to the same tonnages
material_emissions(
  paper_use = c(board = 10, paper = 5),
  metal_use = c(aluminium = 0.4, steel_cans = 0.2),
  glass = 3, glass_waste = TRUE,
  paper_waste_disposal = "Closed-loop",
  metal_waste_disposal = "Landfill",
  glass_waste_disposal = "Closed-loop",
  units = "kg"
)

Run the code above in your browser using DataLab