Learn R Programming

carbonr (version 0.2.7)

household_emissions: Calculate household material emissions (vector-first)

Description

Sums emissions from paper, plastics, metals, electrical, construction (delegated to their calculators) plus household-specific streams: Glass/Clothing/Books (GCB), Organic (food/drink/compost), and Household residual waste.

Usage

household_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"),
  gcb_use = stats::setNames(numeric(), character()),
  gcb_waste = TRUE,
  gcb_waste_disposal = c("Closed-loop", "Combustion", "Landfill"),
  organic_use = stats::setNames(numeric(), character()),
  organic_waste = TRUE,
  compost_waste_disposal = c("Anaerobic digestion", "Combustion", "Composting",
    "Landfill"),
  household_residual_waste = 0,
  hh_waste_disposal = c("Combustion", "Landfill"),
  units = c("kg", "tonnes"),
  value_col = c("value", "value_2024"),
  strict = TRUE
)

Value

Numeric total emissions in requested units.

Arguments

paper_use, plastic_use, metal_use, electrical_use, construction_use

Named numeric vectors (tonnes) passed to the corresponding calculators.

paper_waste, plastic_waste, metal_waste, electrical_waste, construction_waste

Logical; if TRUE, apply waste factors to the same tonnages as *_use.

paper_material_production, metal_material_production, construction_material_production

Single string or per-material named vector for MU column text; forwarded.

paper_waste_disposal, plastic_waste_disposal, metal_waste_disposal, electrical_waste_disposal, construction_waste_disposal

Waste route per family; forwarded.

gcb_use

Named numeric vector for Glass/Clothing/Books (keys: glass, clothing, books). E.g., gcb_use = c(glass = 3, books = 0.5)

gcb_waste

Logical; if TRUE, apply GCB waste factors to same tonnages.

gcb_waste_disposal

One of "Closed-loop", "Combustion", "Landfill".

organic_use

Named numeric vector for food, drink, compost_from_garden, compost_from_food_and_garden.

organic_waste

Logical; if TRUE, apply organic waste factors to same tonnages.

compost_waste_disposal

One of "Anaerobic digestion", "Combustion", "Composting", "Landfill".

household_residual_waste

Numeric (tonnes).

hh_waste_disposal

"Combustion" or "Landfill".

units

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

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 as 0.

Inputs

Provide named *_use vectors in tonnes and *_waste = TRUE/FALSE flags. Unknown names in gcb_use / organic_use are ignored with a warning.

Examples

Run this code
household_emissions(
  gcb_use = c(glass = 3, books = 0.5),
  organic_use = c(food = 1, drink = 0.5),
  household_residual_waste = 0.8,
  gcb_waste = TRUE, organic_waste = TRUE,
  gcb_waste_disposal = "Closed-loop",
  compost_waste_disposal = "Anaerobic digestion",
  hh_waste_disposal = "Combustion",
  units = "kg"
)

Run the code above in your browser using DataLab