Skip to content

Commit

Permalink
updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyclements committed Jun 4, 2024
1 parent 770a678 commit 434f8dd
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 164 deletions.
131 changes: 67 additions & 64 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,63 +30,68 @@ status](https://www.r-pkg.org/badges/version/carbonr)](https://CRAN.R-project.or

## Overview

carbonr is a package in R to conveniently calculate carbon-equivalent emissions. The emissions values in the calculations are from the [UK Government report (2023)](https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2023) whereever available.
`carbonr` is an R package designed to conveniently calculate carbon-equivalent emissions using data from the [UK Government report (2023)](https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2023).

## Installation

You can install the development version of carbonr from [GitHub](https://github.com/) with:
Install the development version from GitHub with:

```{r, eval = FALSE}
# install.packages("devtools")
devtools::install_github("IDEMSInternational/carbonr")
```

## Aims of carbonr
In 2021, work began on the `carbonr` package in R with the aim of addressing the following challenges and improving the estimation of carbon-equivalent emissions. This came after a review of current approaches to estimate carbon-equivalent emissions.

`carbonr` aims to provide a reliable and reproducible approach to calculating emissions levels, ensuring that the results can be saved, edited, and redistributed easily. Further, `carbonr` aims to be transparent in its calculations and values applied. This has the bonus of allowing for flexibility and customisation in estimating carbon-equivalent emissions.

The vision for `carbonr` is to expand and become more comprehensive. We invite contributions from the community to extend the package's functionality, build additional features, and transform it into a more robust tool for estimating carbon-equivalent emissions. Similarly, we invite open discussions and contribution to capture different perspectives and enhancing the functionality of the package.

Finally, `carbonr` aims to make the estimation of carbon-equivalent emissions more accessible by offering a user-friendly front-end interface using Shiny. This ensures that the tools are easier to use, even for individuals with limited programming experience.
`carbonr` was developed to provide a reliable and reproducible method for calculating carbon-equivalent emissions. It aims to:
- Ensure transparency and flexibility in emissions calculations.
- Facilitate easy saving, editing, and redistribution of results.
- Encourage community contributions to extend functionality.
- Provide a user-friendly interface through Shiny for users with limited programming experience.

## Functions in `carbonr`

Currently, emission estimates relate to travel, materials, day-to-day, and clinically based.

* `airplane_emissions()`
* `ferry_emissions()`
* `rail_emissions()`
* `land_emissions()`
* `vehicle_emissions()`
* `hotel_emissions()`
* `building_emissions()`
* `office_emissions()`
* `household_emissions()`
* `construction_emissions()`
* `electrical_emissions()`
* `material_emissions()`
* `metal_emissions()`
* `paper_emissions()`
* `plastic_emissions()`
* `raw_fuels()`
* `anaesthetic_emissions()`
* `clinical_emissions()`
* `clinical_theatre_data()`

These all return carbon-equivalent emissions in tonnes.

A shiny app is also available by `shiny_emissions()` to calculate carbon-equivalent emissions with a GUI.
Currently, the package includes functions for estimating emissions from various sources:

### Travel-Related Emissions
- `airplane_emissions()`
- `ferry_emissions()`
- `rail_emissions()`
- `land_emissions()`
- `vehicle_emissions()`

### Accommodation-Related Emissions
- `hotel_emissions()`
- `building_emissions()`
- `office_emissions()`
- `household_emissions()`

### Material-Related Emissions
- `construction_emissions()`
- `electrical_emissions()`
- `material_emissions()`
- `metal_emissions()`
- `paper_emissions()`
- `plastic_emissions()`
- `raw_fuels()`

### Clinical Emissions
- `anaesthetic_emissions()`
- `clinical_emissions()`
- `clinical_theatre_data()`

All functions return carbon-equivalent emissions in tonnes. A Shiny app is available via `shiny_emissions()` for a GUI-based calculation.

## Usage

We give some small examples in using the functions in `carbonr()`. Further, more comprehensive, examples are available in the vignette.
Below are examples demonstrating how to use the `carbonr` package functions:

```{r, message = FALSE, warning = FALSE}
library(carbonr)
```

To calculate emissions for a flight between Vancouver and Toronto, we first want to find the name of the airports. We do this using the `airport_finder()` function:
### Example 1: Calculating Airplane Emissions
Find the IATA codes for Vancouver and Toronto:

```{r, message = FALSE, warning = FALSE, eval=FALSE, include=TRUE}
airport_finder(name = "Vancouver")
Expand All @@ -103,12 +108,16 @@ airport_finder(name = "Toronto") %>%
knitr::kable()
```

Now we can find the overall emission value using the appropriate IATA code. These distances are calculated using the Haversine formula:
Calculate emissions for a flight between these cities:

```{r, message = FALSE, warning = FALSE}
airplane_emissions("YVR", "YTZ")
```

We can use a data frame to read through the data easier in general. For example, if we had data for multiple individuals, or journeys:
### Example 2: Emissions for Multiple Individuals

Create a data frame for multiple journeys:

```{r, message = FALSE, warning = FALSE, eval=FALSE, include=TRUE}
multiple_ind <- tibble::tribble(~ID, ~rail_from, ~rail_to, ~air_from, ~air_to, ~air_via,
"Clint", "Bristol Temple Meads", "Paddington", "LHR", "KIS", "NBO",
Expand Down Expand Up @@ -137,55 +146,50 @@ multiple_ind %>%
knitr::kable()
```

Additional emissions can be calculated as well. For example, office emissions
### Example 3: Office Emissions

Calculate emissions for office usage:

```{r, message = FALSE, warning = FALSE}
office_emissions(specify = TRUE, electricity_kWh = 255.2, water_supply = 85, heat_kWh = 8764)
```

Alternatively, more advance emissions can be given with other functions, such as the `material_emissions()`, `construction_emissions()`, and `raw_fuels()` functions.
## Beyond the Emissions Available in the 2023 UK Report

### Beyond the Emissions Available in the 2023 UK Report
There are additional more specific functions related to calculating emissions that are not covered in the [UK Government report (2023)](https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2023).
Additional functions are available for emissions not covered in the UK Government report, such as those related to operating theatre waste. Further details on using the operating theatre waste functions are provided in the vignette.

One large set of these relate to operating theatre waste. Usage on this are outlined in the vignette. Alternative sources are used to calculate this set of emissions. The discussions in creating these emissions can be found under issues, and the sources to calculate the emissions can be found in the References section.
### Carbon Credit Prices

Carbon credit prices are additionally available in the `carbon_credit_price()` function where values are based on the [World Bank data](https://carbonpricingdashboard.worldbank.org/). The jurisdiction and year available for that jurisdiction can be found in the `check_CPI()` function.
The `carbon_credit_price()` function provides values based on [World Bank data](https://carbonpricingdashboard.worldbank.org/).

## Shiny App

An interactive calculator using Shiny can be accessed by the `shiny_emissions()` function. This calculator uses some of the functions in the `carbonr` package:

```{r, eval = FALSE}
shiny_emissions()
```

<img src='man/figures/shiny_example.png' align="center" height="400"/>

## For the future
To calculate office emissions, we want the ability for the function to read in data from the office, perhaps accounting data. While the R side of this is relatively straightforward, this is on hold while we look to have an appropriate data set in place.
## For the Future

We intend to build in reports that give information on the users estimated emissions. This would include summary statistics, tables, and graphs.
Planned features include:
- Data integration for office emissions from accounting records.
- Comprehensive reporting tools with summary statistics, tables, and graphs.

## References

### Other online calculators:
* https://carbonfund.org/calculation-methods/
* https://www.carbonfootprint.com/calculatorfaqs.html

### Sources:
[1] For the UK Government Report:

Department for Energy Security and Net Zero. (2023). Greenhouse Gas Reporting: Conversion Factors 2023. Retrieved from https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2023. Published on 7 June 2023, last updated on 28 June 2023.
### Other Online Calculators:
- [Carbonfund.org](https://carbonfund.org/calculation-methods/)
- [Carbon Footprint Calculator](https://www.carbonfootprint.com/calculatorfaqs.html)

Note emissions for flights in the code uses values from direct effects only. `Radiative forcing = TRUE` will give indirect and direct effects. (multiplies by 1.891).
See "business travel - air" sheet of gov.uk excel sheet linked above.

[2] Radiative forcing as 1.891:

DEFRA, 2016. Government GHG conversion factors for company reporting: Methodology paper for emission factors.
### Sources:
1. UK Government Report: Department for Energy Security and Net Zero. (2023). [Greenhouse Gas Reporting: Conversion Factors 2023](https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2023).

[3] For Clinically-based emissions, we expanded beyond the 2023 Government Report since there were not estimates available.
2. Radiative Forcing Factor: DEFRA, 2016. Government GHG conversion factors for company reporting.

Anaesthetic emissions from:
3. Clinical Anaesthetic Emissions: Various sources including -

Varughese, S. and Ahmed, R., 2021. Environmental and occupational considerations of anesthesia: a narrative review and update. Anesthesia & Analgesia, 133(4), pp.826-835;

Expand All @@ -195,5 +199,4 @@ Wyssusek, K., Chan, K.L., Eames, G. and Whately, Y., 2022. Greenhouse gas reduct

Sherman, J., Le, C., Lamers, V. and Eckelman, M., 2012. Life cycle greenhouse gas emissions of anesthetic drugs. Anesthesia & Analgesia, 114(5), pp.1086-1090.

Clinical wet waste emissions from:
Department of Climate Change, Energy, the Environment and Water. (2022). National Greenhouse Accounts Factors: 2022 (p32) [Brochure]. Retrieved from https://www.dcceew.gov.au/climate-change/publications/national-greenhouse-accounts-factors-2022.
4. Clinical Wet Waste Emissions: Department of Climate Change, Energy, the Environment and Water. (2022). [National Greenhouse Accounts Factors: 2022](https://www.dcceew.gov.au/climate-change/publications/national-greenhouse-accounts-factors-2022).
Loading

0 comments on commit 434f8dd

Please sign in to comment.