Title: Predict Carbon Emissions for UK SMEs
Version: 1.0.0
Description: Predict Scope 1, 2 and 3 carbon emissions for UK Small and Medium-sized Enterprises (SMEs), using Standard Industrial Classification (SIC) codes and annual turnover data. The 'carbonpredict' package provides single and batch prediction, plotting, and workflow tools for carbon accounting and reporting. The package utilises pre-trained models, leveraging rich classified transaction data to accurately predict Scope 1, 2 and 3 carbon emissions for UK SMEs as well as identifying emissions hotspots. The methodology used to produce the estimates in this package is fully detailed in the following peer-reviewed publication in the Journal of Industrial Ecology: Phillpotts, A., Owen. A., Norman, J., Trendl, A., Gathergood, J., Jobst, Norbert., Leake, D. (2025) <doi:10.1111/jiec.70106> "Bridging the SME Reporting Gap: A New Model for Predicting Scope 1 and 2 Emissions".
License: MIT + file LICENSE
URL: https://github.com/david-leake/carbonpredict
Encoding: UTF-8
Depends: R (≥ 3.5.0)
RoxygenNote: 7.3.2
Imports: dplyr, ggplot2, progress, lmerTest, networkD3, htmltools, htmlwidgets
Suggests: testthat (≥ 3.0.0), mockery, png, grid
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2025-10-08 16:51:03 UTC; Hamza
Author: Hamza Suleman [aut, cre, cph], Alec Phillpotts [ctb, aut], David Leake [ctb, aut]
Maintainer: Hamza Suleman <Hamza.Suleman@lloydsbanking.com>
Repository: CRAN
Date/Publication: 2025-10-14 18:00:12 UTC

Batch Predict Emissions

Description

Prediction entry point for batch SME and agriculture emissions

Usage

batch_predict_emissions(data, output_path = NULL, company_type = "sme")

Arguments

data

A single entry (list or named vector), a data frame, or a path to a CSV file. The data should contain company_name, 2-digit UK sic_code, and annual turnover columns.

output_path

Optional file path to save the results as a CSV. If NULL, results are not saved to a file.

company_type

A single parameter "sme" or "farm" to determine which emission prediction functions to call (defaults to "sme").

Value

A data frame with input columns and predicted emissions for each scope (in tCo2e). Optionally saved to a CSV file.

Examples

sample_data <- read.csv(system.file("extdata", "sme_examples.csv", package = "carbonpredict"))
sample_data <- head(sample_data, 3)
batch_predict_emissions(data = sample_data, output_path = NULL, company_type = "sme")

Batch SME Plots

Description

Batch plot SME Scope 1 & 2 emissions

Usage

batch_sme_plots(data, output_path = NULL)

Arguments

data

A data frame or path to a CSV file with columns "sic_code", "turnover", and optionally "company_name".

output_path

Optional directory to save plots. If NULL, plots are not saved.

Value

Donut chart plots showing scope 1 and 2 predicted emissions (in tCo2e) for each row in the data. Optionally saved to a directory as PNG files.

Examples

sample_data <- read.csv(system.file("extdata", "sme_examples.csv", package = "carbonpredict"))
sample_data <- head(sample_data, 3)
batch_sme_emissions <- batch_predict_emissions(
data = sample_data,
company_type = "sme",
output_path = NULL)
batch_sme_plots(data = batch_sme_emissions, output_path = NULL)

Plot Scope 3 Emissions Breakdown

Description

Plots a Sankey diagram showing the breakdown of Scope 3 emissions by category.

Usage

plot_scope3_emissions(scope3_df, company_name = NULL)

Arguments

scope3_df

Data frame output from sme_scope3 (must contain 'Category', 'Description', and 'Predicted Emissions (tCO2e)').

company_name

Optional company name to include in the chart title (character string).

Value

A Sankey plot showing a breakdown for predicted emissions of each Scope 3 category.

Examples

scope3_df <- sme_scope3(85, 12000000)
plot_scope3_emissions(scope3_df, company_name = "Carbon Predict LTD")

Plot SME Emissions

Description

Plot a donut chart of Scope 1,2 and 3 emissions

Usage

plot_sme_emissions(
  scope1_emissions,
  scope2_emissions,
  scope3_emissions,
  company_name = NULL
)

Arguments

scope1_emissions

Value for total Scope 1 emissions (numeric).

scope2_emissions

Value for total Scope 2 emissions (numeric).

scope3_emissions

Value for total Scope 3 emissions (numeric).

company_name

Optional company name to include in the chart title (character string).

Value

A ggplot2 donut chart showing predicted emissions for each scope.

Examples

scope_1 = sme_scope1(85, 12000000)
scope_2 = sme_scope2(85, 12000000)
scope_3 = sme_scope3(85, 12000000)
plot_sme_emissions(
scope1_emissions = scope_1$`Predicted Emissions (tCO2e)`,
scope2_emissions = scope_2$`Predicted Emissions (tCO2e)`,
scope3_emissions = scope_3[scope_3$Category == "Total", "Predicted Emissions (tCO2e)"][[1]],
company_name = "Carbon Predict LTD")

SME Emissions Profile

Description

Calls the Scope 1, 2 and 3 emissions prediction functions and returns their results as a list and plots a donut chart

Usage

sme_emissions_profile(sic_code, turnover, company_name = NULL)

Arguments

sic_code

A 2-digit UK SIC code (numeric).

turnover

Annual turnover value (numeric).

company_name

Optional company name for labeling plots (character string).

Value

A list with four elements: scope1, scope2 scope3, scope3_hotspots, each containing the predicted carbon emissions data frame (in tCo2e), the top 5 scope 3 emissions hotspots, as well as a donut chart and Sankey diagram showing the emissions breakdowns.

Examples

sme_emissions_profile(sic_code = 85, turnover = 12000000, company_name = "Carbon Predict LTD")

Predict SME Scope 1 Emissions

Description

This function loads a pre-trained emission model to predict scope 1 carbon emissions for a given SIC code and turnover.

Usage

sme_scope1(sic_code, turnover)

Arguments

sic_code

A 2-digit UK SIC code (numeric).

turnover

Annual turnover value (numeric).

Value

A data frame with predicted emissions (in tCo2e).

Examples

sme_scope1(sic_code = 85, turnover = 12000000)

Predict SME Scope 2 Emissions

Description

This function loads a pre-trained emission model to predict scope 2 carbon emissions for a given SIC code and turnover.

Usage

sme_scope2(sic_code, turnover)

Arguments

sic_code

A 2-digit UK SIC code (numeric).

turnover

Annual turnover value (numeric).

Value

A data frame with predicted emissions (in tCo2e).

Examples

sme_scope2(sic_code = 85, turnover = 12000000)

Predict SME Scope 3 Emissions

Description

This function loads pre-trained emissions models to predict scope 3 carbon emissions for a given SIC code and turnover.

Usage

sme_scope3(sic_code, turnover)

Arguments

sic_code

A 2-digit UK SIC code (numeric).

turnover

Annual turnover value (numeric).

Value

A data frame with predicted emissions (in tCo2e) for each scope 3 category.

Examples

sme_scope3(sic_code = 85, turnover = 12000000)

Predict Top 5 SME Scope 3 Emissions Hotspots

Description

This function uses pre-computed results to predict the top 5 scope 3 carbon emissions hotspots for a given SIC code.

Usage

sme_scope3_hotspots(sic_code)

Arguments

sic_code

A 2-digit UK SIC code (numeric).

Value

A data frame with the top 5 emissions hotspots for scope 3.

Examples

sme_scope3_hotspots(sic_code = 85)