carbonr
carbonr
is a package in R to conveniently calculate
carbon-equivalent emissions.
The emissions values in the calculations are mostly from the UK Government report (2023) when available. It is specified where the calculations have come from if they are not from the UK Government report (2023).
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.
You can install the development version of carbonr from GitHub:
C:4de054e47239-to-carbonr.R
Currently in carbonr
, you can calculate your emissions
from raw materials, such as raw fuels, paper, or metal emissions, or you
can calculate from different categories such as flights, overall office
or household estimated emissions, or vehicles. There are additional
options relating specifically to operating theatres as well. Functions
include:
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.
We give some small examples in using the functions in
carbonr()
.
C:4de054e47239-to-carbonr.R
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:
C:4de054e47239-to-carbonr.R
Name | City | Country | IATA |
---|---|---|---|
Vancouver International Airport | Vancouver | Canada | YVR |
Vancouver Harbour Water Aerodrome | Vancouver | Canada | CXH |
Vancouver International Seaplane Base | Vancouver | Canada |
C:4de054e47239-to-carbonr.R
C:4de054e47239-to-carbonr.R
Name | City | Country | IATA |
---|---|---|---|
Billy Bishop Toronto City Centre Airport | Toronto | Canada | YTZ |
Toronto/Oshawa Executive Airport | Oshawa | Canada | YOO |
C:4de054e47239-to-carbonr.R
Now we can find the overall emission value using the appropriate IATA code. These distances are calculated using the Haversine formula:
C:4de054e47239-to-carbonr.R
A similar approach can be performed for ferry emissions. For example,
to calculate emissions for a round trip ferry from Melbourne to New
York, we first find the appropriate seaport code with the
seaport_finder()
function:
C:4de054e47239-to-carbonr.R
country | city | country_code | port_code | latitude | longitude |
---|---|---|---|---|---|
Australia | Point Henry Pier/Melbourne | AU | PHP | -38.07 | 144.26 |
Australia | Port Melbourne | AU | POR | -37.50 | 144.56 |
C:4de054e47239-to-carbonr.R
C:4de054e47239-to-carbonr.R
country | city | country_code | port_code | latitude | longitude |
---|---|---|---|---|---|
United States | Brooklyn/New York | US | BOY | 40.44 | -73.56 |
C:4de054e47239-to-carbonr.R
Now we can find the overall emission value using the appropriate seaport code:
C:4de054e47239-to-carbonr.R
For the UK we can calculate emissions for a train journey. Like with
airplane_emissions()
and ferry_emissions()
,
the distances are calculated using the Haversine formula - this is
calculated as the crow flies. As before, we first find the stations. As
always, for a more accurate estimation we can include via points:
To calculate emissions for a train journey from Bristol Temple Meads
to Edinburgh Waverley, via Birmingham New Street. We can use a data
frame and purrr::map()
to read through the data easier:
multiple_ind <- tibble::tribble(~ID, ~station,
"From", "Bristol",
"To", "Edinburgh",
"Via", "Birmingham")
purrr::map(.x = multiple_ind$station, .f = ~rail_finder(.x)) %>%
dplyr::bind_rows()
C:4de054e47239-to-carbonr.R
station_code | station | region | county | district | latitude | longitude |
---|---|---|---|---|---|---|
BPW | Bristol Parkway | South West | South Gloucestershire | South Gloucestershire | 51.51380 | -2.542163 |
BRI | Bristol Temple Meads | South West | Bristol City Of | Bristol City Of | 51.44914 | -2.581315 |
EDB | Edinburgh | Scotland | Edinburgh City Of | Edinburgh City Of | 55.95239 | -3.188228 |
EDP | Edinburgh Park | Scotland | Edinburgh City Of | Edinburgh City Of | 55.92755 | -3.307664 |
BBS | Birmingham Bordesley | West Midlands | West Midlands | Birmingham | 52.47187 | -1.877769 |
BHI | Birmingham International | West Midlands | West Midlands | Solihull | 52.45081 | -1.725857 |
BHM | Birmingham New Street | West Midlands | West Midlands | Birmingham | 52.47782 | -1.900205 |
BMO | Birmingham Moor Street | West Midlands | West Midlands | Birmingham | 52.47908 | -1.892473 |
BSW | Birmingham Snow Hill | West Midlands | West Midlands | Birmingham | 52.48335 | -1.899088 |
C:4de054e47239-to-carbonr.R
Then we can estimate the overall tCO2e emissions for the journey:
rail_emissions(from = "Bristol Temple Meads", to = "Edinburgh", via = "Birmingham New Street")
#> [1] 0.02304686
C:4de054e47239-to-carbonr.R
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:
multiple_ind <- tibble::tribble(~ID, ~rail_from, ~rail_to, ~air_from, ~air_to, ~air_via,
"Clint", "Bristol Temple Meads", "Paddington", "LHR", "KIS", "NBO",
"Zara", "Bristol Temple Meads", "Paddington", "LHR", "LAX", "ORL")
multiple_ind %>%
dplyr::rowwise() %>%
dplyr::mutate(plane_emissions = airplane_emissions(air_from,
air_to,
air_via)) %>%
dplyr::mutate(train_emissions = rail_emissions(rail_from,
rail_to)) %>%
dplyr::mutate(total_emissions = plane_emissions + train_emissions)
C:4de054e47239-to-carbonr.R
ID | rail_from | rail_to | air_from | air_to | air_via | plane_emissions | train_emissions | total_emissions |
---|---|---|---|---|---|---|---|---|
Clint | Bristol Temple Meads | Paddington | LHR | KIS | NBO | 2.090193 | 0.0074051 | 2.097598 |
Zara | Bristol Temple Meads | Paddington | LHR | LAX | ORL | 3.085740 | 0.0074051 | 3.093146 |
C:4de054e47239-to-carbonr.R
Additional emissions can be calculated as well. For example, office emissions
office_emissions(specify = TRUE, electricity_kWh = 255.2, water_supply = 85, heat_kWh = 8764)
#> [1] 0.002345161
C:4de054e47239-to-carbonr.R
Alternatively, more advance emissions can be given with other
functions, such as the material_emissions()
,
construction_emissions()
, and raw_fuels()
functions.
Upon request, we have introduced the estimation of CO2e emissions specifically for operating theatres. We walk through a small example to demonstrate this function.
To begin, we’ll create a dummy data frame of clinical data. The data frame will serve as a representative sample of the information typically found in operating theatres. It could include various parameters such as the anaesthetic type (desflurane, isoflurane), the wet clinical waste in kg, the electricity in kWh, and general waste in kg.
df <- data.frame(time = c("10/04/2000", "10/04/2000", "11/04/2000", "11/04/2000", "12/04/2000", "12/04/2000"),
theatre = rep(c("A", "B"), times = 3),
desflurane = c(30, 0, 25, 0, 28, 0),
isoflurane = c(0, 37, 0, 30, 0, 35),
clinical_waste = c(80, 90, 80, 100, 120, 110),
electricity_kwh = c(100, 110, 90, 100, 100, 110),
general_waste = c(65, 55, 70, 50, 60, 30))
C:4de054e47239-to-carbonr.R
time | theatre | desflurane | isoflurane | clinical_waste | electricity_kwh | general_waste |
---|---|---|---|---|---|---|
10/04/2000 | A | 30 | 0 | 80 | 100 | 65 |
10/04/2000 | B | 28 | 0 | 90 | 110 | 55 |
11/04/2000 | A | 25 | 0 | 80 | 90 | 70 |
11/04/2000 | B | 0 | 30 | 100 | 100 | 50 |
12/04/2000 | A | 0 | 37 | 120 | 100 | 60 |
12/04/2000 | B | 0 | 35 | 110 | 110 | 30 |
C:4de054e47239-to-carbonr.R
After creating the dummy data frame of clinical data, we can obtain
the CO2e emissions and the carbon price index by the
clinical_theatre_data
function. This information can be
conveniently presented in a table format:
# get emissions and CPI (carbon price index)
clinical_theatre_data(df, time = time, name = theatre,
wet_clinical_waste = clinical_waste,
wet_clinical_waste_unit = "kg",
average = general_waste,
plastic_units = "kg",
electricity_kWh = electricity_kwh,
include_cpi = TRUE,
jurisdiction = "Australia",
year = 2023)
C:4de054e47239-to-carbonr.R
time | theatre | emissions | carbon_price_credit |
---|---|---|---|
10/04/2000 | A | 0.2994651 | 3.185865 |
10/04/2000 | B | 0.2799792 | 2.978564 |
11/04/2000 | A | 0.3122287 | 3.321652 |
11/04/2000 | B | 0.2705084 | 2.877809 |
12/04/2000 | A | 0.3191129 | 3.394888 |
12/04/2000 | B | 0.2199980 | 2.340453 |
C:4de054e47239-to-carbonr.R
An interactive calculator using Shiny can be accessed by the
shiny_emissions()
function. This calculator uses some of
the functions in the carbonr
package:
C:4de054e47239-to-carbonr.R
UK Government Report: Department for Energy Security and Net Zero. (2023). Greenhouse Gas Reporting: Conversion Factors 2023.
Radiative Forcing Factor: DEFRA, 2016. Government GHG conversion factors for company reporting.
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;
McGain, F., Muret, J., Lawson, C. and Sherman, J.D., 2020. Environmental sustainability in anaesthesia and critical care. British Journal of Anaesthesia, 125(5), pp.680-692;
Wyssusek, K., Chan, K.L., Eames, G. and Whately, Y., 2022. Greenhouse gas reduction in anaesthesia practice: a departmental environmental strategy. BMJ Open Quality, 11(3), p.e001867;
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.