
CVD Prevent is an R package that provides a user-friendly interface to the NHS CVDPREVENT API. This enables analysts, researchers and healthcare professionals to access and work with England-wide primary care cardiovascular disease (CVD) audit data directly from R.
The Cardiovascular Disease Prevention Audit (CVDPREVENT) automatically extracts routinely held GP data. The Data & Improvement Tool provides open access to the data, with clear, actionable insights for those tasked with improving cardiovascular health.
You can install the latest development version from GitHub with:
# install.packages("pak")
pak::pak("craig-parylo/cvdprevent")Or install the latest stable release from CRAN:
pak::pak("cvdprevent")library(cvdprevent)
# List all available indicators (first 4 shown)
cvd_indicator_list() |> head(4)
#> ✖ Validation error: time_period_id - time_period_id is required but missing
#> # A tibble: 1 × 7
#> context error status url params resp timestamp
#> <chr> <chr> <int> <chr> <chr> <chr> <dttm>
#> 1 validate_input_id time_period_i… NA <NA> <NA> <NA> 2025-11-05 19:46:25Typical outputs are tibbles, making them easy to filter and manipulate:
# List the latest four time periods for 'Standard' indicators
cvd_time_period_list() |>
dplyr::filter(IndicatorTypeName == "Standard") |>
dplyr::slice_max(order_by = TimePeriodID, n = 4) |>
dplyr::select(TimePeriodID, TimePeriodName)
#> # A tibble: 4 × 2
#> TimePeriodID TimePeriodName
#> <int> <chr>
#> 1 26 To June 2025
#> 2 24 To March 2025
#> 3 22 To December 2024
#> 4 20 To September 2024See the package vignette for more examples and guidance:
vignette("using_cvdprevent", package = "cvdprevent")cvdprevent is designed to work seamlessly with the tidyverse, and depends on:
Install these with:
# install the packages
pak::pak(c(
"httr2",
"jsonlite",
"dplyr",
"purrr",
"tidyr",
"tibble",
"cli",
"glue"
))Contributions, suggestions or bug reports are welcome! Please:
This package is licensed under the MIT License. See LICENSE for details.
For more information, see the package website or the API documentation.