Learn R Programming

Climatehealth Package

Table of Contents

Package Overview

Description

This package provides functions for calculating climate–health indicators and supporting the production of climate–health statistics. The methods implemented in the package follow the statistical framework for climate–health indicators developed under the Standards for Official Statistics on Climate–Health Interactions (SOSCHI) project. You can find out more and stay up to date with the SOSCHI project here.

SOSCHI Topics and Indicators

This package contains scientific functions dedicated to the following topics in the SOSCHI framework. Please note the final methods documents are still in development, so the versions linked below are earlier alpha versions.

TopicTopic OwnerMethods
Temperature-related health effectsONSMethodology Document
Health effects of wildfiresONSMethodology Document
Mental healthONSMethodology Document
Water-borne diseasesAIMSMethodology Document
Health effects of air pollutionAIMSMethodology Document
Vector-borne diseasesRIPS/AIMSMethodology Document

[!NOTE] Please note that there may be some inconsistencies between the indicators and methods included in the Github code/R package, and those described in the corresponding SOSCHI topic documents, and/or related analysis publications. This is because the final methods documents are still in development, so those linked below in the section 'SOSCHI Topics and Indicators' are an earlier alpha version.

For information on how to use this R package, check here

Package Installation

Requirements

To install and use the package, you need an R environment. This package has been developed primarily with R 4.4.1, and that version is recommended where possible. R-4.4.1 can be downloaded here

Installation options

You can use the package in several ways, depending on whether you want a stable release or want to work with the source code.

1. Load from a local GitHub clone for development

Use this option if you want to inspect the source code, make changes locally, test updates, or contribute to the package.

First clone the repository from GitHub to your machine. Then in R:

install.packages("devtools")
devtools::load_all(path = "{path/to/climatehealth}")

This loads the package directly from the local source directory into your current R session. This is useful for development, but won't make the climatehealth package available as a standard installed package in your library. Once the source code changes, run devtools::load_all() again to reload the updated functions. If you are an end user, follow the standard installation procedure outlined below for your operating system.

2. Install directly from GitHub

If you want to install the latest development version of the package directly from GitHub without cloning the repository, you can use remotes::install_github().

First install the remotes package in R if needed:

install.packages("remotes")

Then install the package with:

remotes::install_github("onssoschi/climatehealth")

This installs the package from the GitHub repository into your R library in the usual way. This option is useful if you want the latest development version of the package but do not need to edit the source code locally.

3. Install the latest Windows binary release (pre-compiled)

If you would like to install the latest official release of the package, download the .zip file from the latest GitHub release here. Then install it in R with:

install.packages(path = "{path/to/climatehealth_<version>.zip}", repos = NULL, type = "win.binary")

where <version> is the version number of the release you downloaded.

4. Install the latest source release for MacOS or other platforms (needs compilation)

If you are using MacOS and would like to install from the source, download the .tar.gz file from the latest GitHub release here. Then install it in R with:

install.packages(path = "{path/to/climatehealth_<version>.tar.gz}", repos = NULL, type = "source")

where <version> is the version number of the release you downloaded.

Running analysis

Once the package is installed or loaded, you can run any of the main analysis entry points depending on your use case.

Indicator workflows

Most indicator modules are run through a top-level *_do_analysis() function. For example:

result <- climatehealth::air_pollution_do_analysis(
  data_path = "{path/to/your_data.csv}"
)

Other indicators follow the same pattern, for example:

temp_mortality_do_analysis()
wildfire_do_analysis()
malaria_do_analysis()
diarrhea_do_analysis()
suicides_heat_do_analysis()

Each analysis function expects specific input data and parameters for that indicator, so refer to the package documentation for the relevant module before running it.

Example usage scripts for the main indicator workflows are provided in inst/examples/, including:

  • air_pollution_usage.R
  • temp_mortality_usage.R
  • wildfires_usage.R
  • malaria_usage.R
  • diarrhea_usage.R
  • suicides_heat_usage.R
  • descriptive_stats_usage.R

Descriptive statistics

You can also run the descriptive statistics workflow directly:

result <- climatehealth::run_descriptive_stats(
  data = my_data,
  output_path = "{path/to/output}"
)

This is useful for checking data quality, exploring variables, and generating summary outputs before running an indicator-specific workflow.

Contributing to the package

We welcome contributions from public users, collaborators, and developers who want to improve the package. If you want to contribute code, documentation, tests, or bug fixes, please start by reading the CONTRIBUTING guide CONTRIBUTING. This includes guidance on setting up a local development workflow, making changes safely, and submitting updates through GitHub.

Authors

The package authors reflect direct intellectual and technical contributions to the package architecture, module methods, and reproducible analytical workflows.

  • Lead author: Charlie Browning
  • Lead maintainer and platform developer: Kenechi Omeke
  • Authors: Etse Yawo Dzakpa, Gladin Jose, Matt Pearce, Ellie Watkins, Claire Hunt, Beatrice Byukusenge, Cassien Habyarimana, Venuste Nyagahakwa, Felix Scarbrough, Treesa Shaji, Bonnie Lewis, and Vijendra Ingole

Contributors

The following contributors supported the package through bug fixes, minor features, testing, documentation, and review work:

  • Sean Lovell
  • Antony Brown
  • Euan Soutter
  • Gillian Flower
  • David Furley
  • Joe Panes
  • Charlotte Romaniuk
  • Milly Powell

Project Lead

  • Myer Glickman, Bonnie Lewis and Vijendra Ingole

Methodology review

  • Sewe Maquines

Acknowledgements

We acknowledge the Topic Expert Group members and Expert Advisory Group members for higher-level leadership, methodological input, and subject-area support to the SOSCHI climate-health work. We also acknowledge the use of external data and code examples that informed testing and early prototyping.

Copyright

This is an open access R package published under a UK Open Government Licence 3.0 which is compatible with the Creative Commons CC-BY-SA 4.0 licence. You are free to copy, publish, distribute and adapt the information, provided you acknowledge the source and link to this R package (see citation below). Enquiries concerning the application of this R package can be made to the project team at climate.health@ons.gov.uk.

Citation

If you use climatehealth in publications, cite the package as:

Browning, C., Omeke, K., Dzakpa, E. Y., Jose, G., Pearce, M., Watkins, E., Hunt, C., Byukusenge, B., Habyarimana, C., Nyagahakwa, V., Scarbrough, F., Shaji, T., Lewis, B., and Ingole, V. (2026). climatehealth: Epidemiological Tools for Climate-Health Impact Assessment. R package.

An R package citation file is provided at inst/CITATION.

Funding

This work was supported by Wellcome.

Copy Link

Version

Install

install.packages('climatehealth')

Version

1.0.0

License

MIT + file LICENSE

Maintainer

Kenechi Omeke

Last Published

March 30th, 2026

Functions in climatehealth (1.0.0)

create_na_summary

Create a summary of all NA values in a dataset.
casecrossover_quasipoisson

Fit quasipoisson regression models for different lags using a time-stratified case-crossover approach.
diarrhea_do_analysis

Code for calculating Diarrhea disease cases attributable to extreme precipitation and extreme temperature Run Full diarrhea-Climate Analysis Pipeline
check_diseases_vif

Check multicollinearity using VIF on model variables
calculate_air_pollution_grid_dims

Generate a grid size for a certain number of plots.
check_file_extension

Check that a file extension on a given path matches the expected.
calculate_daily_AF_AN

Calculate attributable numbers and fraction of a given health outcome.
check_file_exists

Check that a file exists at a passed path.
.english_dow_names

English day of week names
dlnm_meta_analysis

Meta-analysis and BLUPs
create_lagged_variables

Generate lagged values for predictor (temperature) variables
dlnm_pop_totals

Create population totals
dlnm_min_mortality_temp

Define minimum mortality percentiles and temperatures
dlnm_reduce_cumulative

Reduce to overall cumulative
create_correlation_matrix

Create a correlation matrix for columns in a dataframe.
create_inla_indices

Create indices for INLA models
check_and_write_vif

Check multicollinearity using VIF and write the results to file
calculate_qaic

QAIC calculation
calculate_wildfire_rr_by_region

Passes data to casecrossover_quasipoisson to calculate RR.
check_empty_dataframe

Check if a dataframe is empty.
create_grid

Generate a grid size for a certain number of plots.
hc_add_national_data

Process data for national analysis
dlnm_vif

Produce variance inflation factor
.english_month_names

English month names
hc_create_crossbasis

Create cross-basis matrix
common_descriptive_stats_core

Deprecated alias for descriptive_stats_core().
create_column_summaries

Create statistical summaries of columns in a dataframe.
check_wildfire_vif

Check variance inflation factors of predictor variables using a linear model
generate_descriptive_stats_run_id

Generate a run id for descriptive statistics output folders.
create_temperature_splines

Generate splines for temperature variable
hc_predict_subnat

Run predictions from model
hc_plot_rr

Plot results of relative risk analysis
dlnm_power_list

Power calculation
dlnm_predict_nat

Run national predictions from meta analysis
create_air_pollution_lags

Create lagged values for PM2.5 variable and average lag column.
hc_model_combo_res

Produce check results of model combinations
contour_plot

Create and plot the exposure-lag-response relationship (contour plot) at country, region or district level for each disease cases type (diarrhea and malaria).
descriptive_stats_core

Core Functionality for Producing Descriptive Statistics
mh_add_national_data

Process data for national analysis
extract_error_metadata

Extract metadata from a climate_error
detect_outliers

Detect Outliers Using the IQR Method
fwald

Calculate p-values for Wald test
extract_means_for_geography

Extract mean wildfire PM2.5 values for shapefile regions from NetCDF file
hc_adf

Run ADF test and produce PACF plots for each model combination
hc_plot_af_cold_monthly

Plot attributable fractions by calendar month - low temperatures
hc_model_validation

Model Validation Assessment
generate_rr_pm_by_region

Generate Relative Risk Estimates by Region
generate_rr_pm_overall

Relative risk estimates across PM2.5 concentrations for a specified lag.
fit_air_pollution_gam

Fit GAM model
hc_attr

Estimate attributable numbers
mh_attr

Estimate attributable numbers
hc_plot_attr_heat_totals

Plot total attributable fractions and rates - high temperatures
hc_plot_ar_heat_monthly

Plot attributable rates by calendar month - high temperatures
hc_plot_ar_cold_yearly

Plot attributable rates by year - low temperatures
hc_attr_tables

Create attributable estimates tables
hc_plot_af_heat_yearly

Plot attributable fractions for heat by year
hc_plot_power

Plot statistical power for temperature mortality analysis
hc_plot_ar_cold_monthly

Plot attributable rates by calendar month - low temperatures
get_alpha_colour

Generate and RGB colour value with alpha from a hex value.
hc_quasipoisson_dlnm

Define and run quasi-Poisson regression with DLNM
plot_air_pollution_an_ar_monthly

Combined Monthly Time Series Plots of AN and AR
is_climate_error

Check if an error is a climate_error
deprecate_descriptive_stats

Emit a consistent deprecation warning for descriptive stats wrappers.
hc_read_data

Read temperature-related mortality indicator data
descriptive_stats

Save descriptive statistics
common_descriptive_stats_api

Deprecated alias for run_descriptive_stats_api().
common_descriptive_stats

Deprecated alias for run_descriptive_stats().
hc_rr_results

Produce cumulative relative risk results of analysis
mh_plot_af_yearly

Plot attributable fractions by year
mh_create_crossbasis

Create cross-basis matrix
mh_plot_ar_monthly

Plot attributable rates by calendar month
mh_model_combo_res

Produce check results of model combinations
get_lags_and_means

Create lagged columns and provide the mean value.
install_INLA

Install the INLA Package from Its Official Repository
enforce_file_extension

Enforce a file extension on a given path
.with_english_locale

Temporarily set English locale for date operations
install_terra

Install the terra Package from the CRAN Archive
hc_save_results

Save results of analysis
plot_air_pollution_forest_by_lag

Plot Relative Risk (RR) by lag
mh_save_results

Save results of analysis - Mental Health
mh_rr_results

Produce cumulative relative risk results of analysis
join_health_and_climate_data

Join health and climate data
hc_plot_ar_heat_yearly

Plot attributable rates by year - high temperatures
load_and_process_data

Read in and format health data - diseases cases type
plot_air_pollution_exposure_response

Plot exposure-response relationship with confidence intervals by region
label_with_unit

Append the units to a column label.
join_ar_and_pm_monthly

Join monthly PM2.5 estimates with attributable risk data by region and time
get_predictions

A function to predict relative risk at country, region, and district level
plot_ar_by_region

Plot Attributable Risk by Region
hc_plot_af_cold_yearly

Plot attributable fractions for cold by year
hc_plot_af_heat_monthly

Plot attributable fractions by calendar month - high temperatures
plot_an_by_region

Plot Total Attributable Number by Region
load_wildfire_data

Load wildfire and health data
load_and_process_map

Read in and format country map data
mh_plot_ar_yearly

Plot attributable rates by year
mh_model_validation

Model Validation Assessment
mh_plot_attr_totals

Plot total attributable fractions and rates
plot_health_climate_timeseries

Plot Time Series of Health and Climate Variables
plot_air_pollution_forest_by_region

Plot forest plot for PM2.5 effects by region
plot_monthly_random_effects

Visualise monthly random effects for selected INLA model
load_air_pollution_data

Read in climate, environmental and health data and rename columns
plot_aggregated_AF_core

Create a plot of aggregated annual attributable fractions with CI
load_and_process_climatedata

Read in and format climate data
hc_plot_attr_cold_totals

Plot total attributable fractions and rates - low temperatures
plot_aggregated_AF

Plots attributable fractions and CI across years by regions
plot_regional_trends

Plot regional trends of a climate and healthoutcome.
plot_rr_by_pm

Plot relative risk by PM2.5 levels for all regions and individually
plot_RR_core

Core functionality for plotting results of relative risk analysis.
plot_RR

Plot relative risk results by region (if available).
mh_plot_af_monthly

Plot attributable fractions by calendar month
plot_rr_by_pm_core

Create a relative risk plot across PM2.5 levels for a single region
run_descriptive_stats_api

Create descriptive statistics via API-friendly inputs.
mh_attr_tables

Create attributable estimates tables
mh_casecrossover_dlnm

Quasi-Poisson Case-Crossover model with DLNM
mh_predict_reg

Run regional predictions from model
mh_read_and_format_data

Read in and format data - Mental Health
read_and_format_data

Code for producing analysis for health effects of extreme weather events - wildfires Read in and format health data
plot_moving_average

Plot the moving average of a column.
plot_air_pollution_power

Plot Power vs PM2.5 Concentration
plot_air_pollution_monthly_histograms

Plot histograms for AN and AR by month
plot_rate_overall

Plot the rate of a dependent variable per 100,000 population per year.
run_inla_models

Run models of increasing complexity in INLA: Fit a baseline model including spatiotemporal random effects.
plot_seasonal_trends

Plot seasonal trends of a health outcome and climate by month.
plot_total_variables_by_year

Plot the total of selected variables per year.
malaria_do_analysis

Code for calculating Malaria disease cases attributable to extreme rainfall and extreme temperature Run Full Malaria-Climate Analysis Pipeline
mh_plot_power

Plot power
set_cross_basis

Create a cross-basis matrix set for DLNM analysis
suggest_column_match

Suggest a column name based on fuzzy matching
mh_plot_rr

Plot results of relative risk analysis - Mental Health
plot_yearly_spatial_random_effect

Visualize yearly spatial random effect of the Diseases Incidence Rate (DIR).
prepare_descriptive_input

Normalise descriptive stats data input to combined and regional dataframes.
read_input_data

Read a csv file into memory as a data frame.
plot_relative_risk

Read in Relative Risk plot at country, Region, and District level
plot_air_pollution_an_ar_by_year

Plot the AN and AR by year
plot_avg_monthly

Plot Average Monthly Attributable Health Metrics with Climate Overlays
plot_air_pollution_an_ar_by_region

Combined AN and AR plots by region
plot_scatter_grid

Plot a grid of scatter graphs comparing one column to various others.
plot_distributions

Plot histograms of column distributions.
save_air_pollution_plot

Save air pollution plot with standardized dimensions
plot_attribution_metric

Plot Attributable Health Metrics Across Spatial and Temporal Levels
plot_correlation_matrix

Plot a correlation matrix include a heatmap.
plot_ar_pm_monthly

Plot monthly deaths and PM2.5 concentrations with dual y-axes
plot_rr_map

Plot Relative Risk Map at sub-national Level
run_descriptive_stats

Run generic descriptive statistics and EDA outputs for indicator datasets.
validate_descriptive_columns

Preflight validation for descriptive statistics columns based on enabled features.
save_wildfire_results

Save results of wildfire related analysis
plot_boxplots

Plot a grid of box plots for multiple numeric variables
validate_case_type

Ensure that the case_type parameter is valid
prepare_descriptive_output_dir

Validate and prepare base output directory for descriptive stats.
raise_if_null

Raise an Error if a Parameter's Value is NULL
reformat_data

Reformat a dataframe using various different cleaning techniques.
suicides_heat_do_analysis

Full analysis pipeline for the suicides and extreme heat indicator
time_stratify

Stratify data by time period
temp_mortality_do_analysis

Full analysis for the 'mortality attributable to high and low temperatures' indicator
with_pdf_device

Run plotting code inside a safely managed PDF device.
wildfire_do_analysis

This is full analysis pipeline to analyse the impact of wildfire-related PM2.5 on a health outcome.
summarise_AF_AN

Summarise AF and AN numbers by region and year
aggregate_air_pollution_by_region

Aggregate air pollution results by region
abort_model_error

Raise a model error (statistical/computational failures)
abort_validation

Raise a validation error (data/parameter issues)
air_pollution_do_analysis

Comprehensive Air Pollution Analysis Pipeline
aggregate_air_pollution_by_month

Aggregate air pollution results by month
aggregate_by_column

Split dataframe into multiple dataframes, based on a columns value.
aggregate_air_pollution_by_year

Aggregate air pollution results by year
air_pollution_descriptive_stats

Descriptive statistics
abort_column_not_found

Raise a column-not-found error with available columns
abort_climate

Raise a typed error with structured metadata
air_pollution_power_list

Air Pollution Power Calculation using Meta Results
air_pollution_meta_analysis

Perform meta analysis with multiple lag structures
analyze_air_pollution_daily

Calculate daily RR/AF/AN/AR for region-specific/national distributed lag effects for a chosen PM2.5 reference.
an_attrdl

FUNCTION FOR COMPUTING ATTRIBUTABLE MEASURES FROM DLNM
climatehealth-package

climatehealth: Statistical Tools for Modelling Climate-Health Impacts
attribution_calculation

Calculate Attributable Metrics for Climate-Health Associations.
attrdl

FUNCTION FOR COMPUTING ATTRIBUTABLE MEASURES FROM DLNM
combine_health_climate_data

Read in and combine climate and health data
check_has_rtools

Check for Rtools Installation on Windows