knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

codecov R build status

fingertipsR

This is an R package to interact with Public Health England's Fingertips data tool. Fingertips is a major public repository of population and public health indicators for England. The site presents the information in many ways to improve accessibility for a wide range of audiences ranging from public health professionals and researchers to the general public. The information presented is a mixture of data available from other public sources, and those that are available through user access agreements with other organisations. The source of each indicator presented is available using the indicator_metadata() function.

This package can be used to load data from the Fingertips API into R for further use.

Installation

rOpenSci

Get the latest released, stable version from rOpenSci:

# Enable repository from ropensci
options(repos = c(
  ropensci = 'https://ropensci.r-universe.dev',
  CRAN = 'https://cloud.r-project.org'))

# Download and install fingertipsR in R
install.packages('fingertipsR')

With remotes

You can install the latest development version from github using remotes:

# install.packages("remotes")
remotes::install_github("rOpenSci/fingertipsR",
                        build_vignettes = TRUE,
                        dependencies = "suggests")

Example

This is an example of a workflow for downloading data for the indicator on Healthy Life Expectancy at Birth from the Public Health Outcomes Framework profile.

The profiles() function presents all of the available profiles:

library(fingertipsR)
profs <- profiles()
profs <- profs[grepl("Public Health Outcomes Framework", profs$ProfileName),]
head(profs)

This table shows that the ProfileID for the Public Health Outcomes Framework is 19. This can be used as an input for the indicators() function:

profid <- 19
inds <- indicators(ProfileID = profid)
print(inds[grepl("Healthy", inds$IndicatorName), c("IndicatorID", "IndicatorName")])

Healthy Life Expectancy at Birth has the IndicatorID equal to 90362.

Finally, the data can be extracted using the fingertips_data() function using that IndicatorID:

indid <- 90362
df <- fingertips_data(IndicatorID = indid, AreaTypeID = 202)
head(df)

Use

Please see the vignettes for information on use.

browseVignettes("fingertipsR")

More information

ropensci_footer



ropensci/fingertipsR documentation built on Feb. 27, 2024, 7:33 a.m.