Package {co2e}


Title: Global Warming Potential Lookups and CO2-Equivalent Conversion
Version: 0.1.0
Description: Provides curated Global Warming Potential (GWP) values from IPCC Assessment Reports 4 through 6, gas name standardization across documented naming variants (IUPAC/common names, per-report naming changes, and EPA/data.gov naming), and CO2-equivalent conversion utilities. Values are drawn from official IPCC source tables, with corrections applied for two substances where the published table is known to contain errors; see the package vignette for details and source-by-source provenance notes.
License: MIT + file LICENSE
Encoding: UTF-8
Imports: dplyr, tibble, stringr
Suggests: tidyr, readr, testthat (≥ 3.0.0), knitr, rmarkdown, spelling
Config/testthat/edition: 3
Depends: R (≥ 4.1.0)
LazyData: true
Config/roxygen2/version: 8.0.0
VignetteBuilder: knitr
Language: en-US
URL: https://github.com/joewcorra/co2e
BugReports: https://github.com/joewcorra/co2e/issues
NeedsCompilation: no
Packaged: 2026-08-30 16:21:11 UTC; joewc
Author: Joe Corra [aut, cre, cph]
Maintainer: Joe Corra <Joewcorra@gmail.com>
Repository: CRAN
Date/Publication: 2026-09-10 14:10:02 UTC

Convert a mass of greenhouse gas to CO2-equivalent

Description

Convert a mass of greenhouse gas to CO2-equivalent

Usage

as_co2e(value, gas, ar = "AR6", horizon = 100)

Arguments

value

Numeric vector of gas quantities (any consistent mass unit).

gas

Character vector of gas identifiers, recycled against value.

ar

Assessment report: one of "AR4", "AR5", "AR6".

horizon

Time horizon in years: one of 20, 100, 500.

Value

A numeric vector of CO2-equivalent quantities, in the same units as value.

Examples

as_co2e(10, gas = "HFC-134a", ar = "AR6", horizon = 100)


Gas name synonyms

Description

Alternate names each gas is known by, for use with standardize_gas().

Usage

gas_synonyms

Format

A tibble with columns:

gas_id

Canonical gas identifier, joins to gases$gas_id.

synonym

An alternate name.

synonym_type

One of "common_name", "ar_naming_variant", "formatting_variant", "epa_name".

note

Free-text provenance/context for this synonym.

Source

Documented naming variants from GHG Protocol Global Warming Potential Values (August 2024) footnotes, IPCC AR6 Table 7.SM.7, and EPA/data.gov naming.


Gas identity reference table

Description

One row per substance covered by the package.

Usage

gases

Format

A tibble with columns:

gas_id

Canonical gas identifier.

formula

Chemical formula.

cas

CAS Registry Number.

gas_group

One of "HFC", "HCFC", "CFC", "halon", "PFC", "other".

is_blend

Logical; always FALSE in the current release (blends are not yet in scope).

Source

Formula and CAS from IPCC AR6 WGI Chapter 7 Supplementary Material, Table 7.SM.7.


Look up a greenhouse gas's Global Warming Potential

Description

Returns the GWP for one or more gases from a given IPCC Assessment Report and time horizon. Vectorized over gas.

Usage

gwp(gas, ar = "AR6", horizon = 100)

Arguments

gas

Character vector of gas identifiers (e.g. "HFC-134a"). Must match gases$gas_id exactly - use standardize_gas() first if your input data uses non-canonical names.

ar

Assessment report: one of "AR4", "AR5", "AR6".

horizon

Time horizon in years: one of 20, 100, 500.

Value

A numeric vector the same length as gas. Returns NA with a warning for any gas/AR/horizon combination not present in gwp_values.

Examples

gwp("HFC-134a", ar = "AR6", horizon = 100)
gwp(c("CO2", "CH4", "HFC-32"), ar = "AR5", horizon = 100)


Compare a gas's GWP across IPCC Assessment Reports

Description

Compare a gas's GWP across IPCC Assessment Reports

Usage

gwp_compare(gas, horizon = 100)

Arguments

gas

A single gas identifier (e.g. "HFC-134a").

horizon

Time horizon in years: one of 20, 100, 500. Defaults to 100.

Value

A tibble with one row per assessment report that reports a value for gas at the given horizon, columns ar and gwp.

Examples

gwp_compare("CFC-11")


Global Warming Potential values by gas, assessment report, and horizon

Description

Long-format lookup table: one row per gas x IPCC Assessment Report x time horizon.

Usage

gwp_values

Format

A tibble with columns:

gas_id

Canonical gas identifier, joins to gases$gas_id.

ar

Assessment report: "AR4", "AR5", or "AR6".

horizon

Time horizon in years: 20, 100, or 500.

gwp

Global Warming Potential (dimensionless, relative to CO2).

source

Citation for this row's value.

Source

EPA/data.gov IPCC AR4-AR6 GWPs, doi:10.23719/1529821; AR6 methane fossil/non-fossil split from GHG Protocol Global Warming Potential Values (August 2024).


Normalize a gas name for matching

Description

Collapses case, whitespace, hyphens, and underscores so that variants like "HFC-134a", "hfc134a", and "HFC 134a" compare equal.

Usage

normalize_key(x)

Arguments

x

Character vector.

Value

Character vector of normalized keys.


Standardize a gas name to its canonical gas_id

Description

Matches input names against gases$gas_id first, then against gas_synonyms$synonym, using a normalized (case/whitespace/hyphen insensitive) comparison. No fuzzy matching is performed - an unmatched name returns NA, it is never guessed at.

Usage

standardize_gas(x)

Arguments

x

Character vector of gas names as they appear in your data.

Value

A tibble with columns input, gas_id (NA if unmatched), and match_type ("gas_id", "synonym", or "unmatched").

Examples

standardize_gas(c("HFC-134a", "R-134a", "not a real gas"))