Learn R Programming

carbonr (version 0.2.7)

electrical_emissions: Electrical emissions

Description

Computes embodied GHG emissions for electrical items using uk_gov_data rows with Level 2 = "Electrical items". Material-use factors come from Level 1 = "Material use", Column Text = material_production (your table currently provides Primary material production only). Waste factors come from Level 1 = "Waste disposal", Column Text = waste_disposal. Factors are kg CO2e per tonne.

Usage

electrical_emissions(
  use = stats::setNames(numeric(), character()),
  waste = TRUE,
  material_production = "Primary material production",
  waste_disposal = c("Landfill", "Open-loop"),
  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 quantities in tonnes. Canonical names supported: fridges, freezers, large_electrical, it, small_electrical, alkaline_batteries, liion_batteries, nimh_batteries. Aliases accepted (case/punct-insensitive), e.g. "fridge", "freezer", "large", "it equipment", "small", "alkaline", "liion", "ni mh", Unknown names warn and are ignored.

waste

Logical. If TRUE, waste tonnages equal use. If FALSE, no waste.

material_production

Either a single string for all items (e.g., "Primary material production") or a named vector per item. Synonyms accepted: "primary", "closed loop", etc. (If a chosen option is absent in the table, behaviour depends on strict.)

waste_disposal

One of "Landfill" or "Open-loop". Applied to all waste.

units

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

value_col

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

strict

If TRUE (default), error when any nonzero use/waste needs a factor missing from the table. If FALSE, treat missing factors as 0.

Examples

Run this code
# Primary production + landfill; waste = use
electrical_emissions(
  use = c(fridges = 1, freezers = 0.5, large_electrical = 0.2),
  waste_disposal = "Landfill",
  waste = TRUE,
  units = "kg"
)

# 2024 factors, no waste, report in tonnes
electrical_emissions(
  use = c(it = 0.01, liion_batteries = 0.002),
  value_col = "value_2024",
  waste = FALSE,
  units = "tonnes"
)

Run the code above in your browser using DataLab