Learn R Programming

carbonr (version 0.2.7)

clinical_theatre_data: Clinical Emissions: Data Frame and Plot

Description

Calculate clinical theatre emissions row-by-row from a data frame. Each row is expanded into a call to clinical_theatre_emissions() using the columns you specify. Optionally, results can be combined with carbon price credit information and plotted.

Usage

clinical_theatre_data(
  data,
  time,
  date_format = "%d/%m/%Y",
  name,
  wet_clinical_waste,
  wet_clinical_waste_unit = c("tonnes", "kg"),
  desflurane = 0,
  sevoflurane = 0,
  isoflurane = 0,
  methoxyflurane = 0,
  N2O = 0,
  propofol = 0,
  water_supply = NULL,
  water_trt = TRUE,
  water_unit = c("cubic metres", "million litres"),
  electricity_kWh = NULL,
  electricity_TD = TRUE,
  electricity_WTT = TRUE,
  heat_kWh = NULL,
  heat_TD = TRUE,
  heat_WTT = TRUE,
  paper_vars = NULL,
  plastic_vars = NULL,
  metal_vars = NULL,
  electrical_vars = NULL,
  construction_vars = NULL,
  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"),
  units = "kg",
  value_col = c("value", "value_2024"),
  strict = TRUE,
  include_cpi = FALSE,
  jurisdiction = NULL,
  year = NULL,
  period = 0,
  manual_price = NULL,
  gti_by = c("default", "month", "year"),
  overall_by = c("default", "month", "year"),
  single_sheet = FALSE
)

Value

If single_sheet = NULL: a tibble with emissions (and carbon_price_credit

if include_cpi = TRUE).

If single_sheet = TRUE/FALSE: a list with the emissions table and a plot object generated by output_display().

Arguments

data

Data frame containing all variables required for emissions calculation.

time

Column in data giving the time variable.

date_format

Character string of date format for time (default: "%d/%m/%Y").

name

Column in data giving the theatre identifier/name.

wet_clinical_waste

Numeric. Amount of (wet) clinical waste.

wet_clinical_waste_unit

Unit for wet_clinical_waste ("tonnes" or "kg").

desflurane

Amount of desflurane used in KG (default: 0).

sevoflurane

Amount of sevoflurane used in KG (default: 0).

isoflurane

Amount of isoflurane used in KG (default: 0).

methoxyflurane

Amount of methoxyflurane used in KG (default: 0).

N2O

Amount of nitrous oxide (N2O) used in KG (default: 0).

propofol

Amount of propofol used in KG (default: 0).

water_supply

numeric, amount of water in the given unit.

water_trt

logical, include treatment emissions (default TRUE).

water_unit

"cubic metres" or "million litres".

electricity_kWh

numeric kWh consumed.

electricity_TD

logical, include T&D losses (default TRUE).

electricity_WTT

logical, include WTT for electricity (default TRUE).

heat_kWh

numeric kWh of heat/steam (onsite; excludes district).

heat_TD

logical, include district heat distribution losses (default TRUE).

heat_WTT

logical, include WTT for heat/steam (default TRUE).

paper_vars

Named character vector mapping canonical paper keys ("board", "mixed", "paper") to column names in data. Each row’s values are passed as a paper_use vector.

plastic_vars

Named character vector mapping canonical plastic keys (e.g. "average", "pet", "pp", "pvc", …) to columns in data.

metal_vars

Named character vector mapping canonical metal keys (e.g. "aluminuim_cans", "steel_cans", "scrap") to columns in data.

electrical_vars

Named character vector mapping canonical electrical keys (e.g. "fridges", "freezers", "it", "alkaline_batteries") to columns in data.

construction_vars

Named character vector mapping canonical construction keys (e.g. "concrete", "bricks", "wood", "metals") to columns in data.

paper_waste, plastic_waste, metal_waste, electrical_waste, construction_waste

Logical. Whether the same tonnage is assumed to go to waste treatment for that material type (default: TRUE).

paper_material_production, metal_material_production, construction_material_production

Column text string for material-use factor (default: "Primary material production").

paper_waste_disposal, plastic_waste_disposal, metal_waste_disposal, electrical_waste_disposal, construction_waste_disposal

Disposal route(s) to use for each material category. See material_emissions() for valid options.

units

Units of result, "kg" or "tonnes". Default: "kg".

value_col

Which column of uk_gov_data to use ("value" or "value_2024").

strict

Logical. If TRUE, error when a factor is missing; if FALSE, treat as zero.

include_cpi

Logical. Whether to add carbon price credit calculations.

jurisdiction

Jurisdiction string for CPI lookup (see check_CPI()).

year, period

CPI year and period to use.

manual_price

Optional numeric CPI value to override World Bank data.

gti_by

Grouping type for GTI calculation ("default", "month", "year").

overall_by

Grouping type for overall output plot.

single_sheet

NULL, TRUE, or FALSE. If not NULL, returns a list with the emissions table and a single-sheet display/plot.

Examples

Run this code
df <- data.frame(
  time = c("10/04/2000","11/04/2000"),
  theatre = c("A","A"),
  clinical_waste = c(80,90),
  electricity_kwh = c(100,110),
  general_waste = c(65,55)
)

clinical_theatre_data(
  df,
  time = time,
  name = theatre,
  wet_clinical_waste = clinical_waste,
  wet_clinical_waste_unit = "kg",
  electricity_kWh = electricity_kwh,
  plastic_vars = c(average="general_waste"),
  units = "kg"
)

Run the code above in your browser using DataLab