- Notifications
You must be signed in to change notification settings - Fork18
R package to interact with Public Health England’s Fingertips data tool
ropensci/fingertipsR
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is an R package to interact with Public Health England’sFingertips data tool. Fingertips is amajor public repository of population and public health indicators forEngland. The site presents the information in many ways to improveaccessibility for a wide range of audiences ranging from public healthprofessionals and researchers to the general public. The informationpresented is a mixture of data available from other public sources, andthose that are available through user access agreements with otherorganisations. The source of each indicator presented is available usingtheindicator_metadata()
function.
This package can be used to load data from the Fingertips API into R forfurther use.
Get the latest released, stable version from rOpenSci:
# Enable repository from ropenscioptions(repos= c(ropensci='https://ropensci.r-universe.dev',CRAN='https://cloud.r-project.org'))# Download and install fingertipsR in Rinstall.packages('fingertipsR')
You can install the latest development version from github usingremotes:
# install.packages("remotes")remotes::install_github("rOpenSci/fingertipsR",build_vignettes=TRUE,dependencies="suggests")
This is an example of a workflow for downloading data for the indicatoronHealthy Life Expectancy at Birth from thePublic Health OutcomesFramework profile.
Theprofiles()
function presents all of the available profiles:
library(fingertipsR)profs<- profiles()profs<-profs[grepl("Public Health Outcomes Framework",profs$ProfileName),]head(profs)#> # A tibble: 6 x 4#> ProfileID ProfileName DomainID DomainName#> <int> <chr> <int> <chr>#> 1 19 Public Health Outcomes Framework 1000049 A. Overarching indicato~#> 2 19 Public Health Outcomes Framework 1000041 B. Wider determinants o~#> 3 19 Public Health Outcomes Framework 1000042 C. Health improvement#> 4 19 Public Health Outcomes Framework 1000043 D. Health protection#> 5 19 Public Health Outcomes Framework 1000044 E. Healthcare and prema~#> 6 19 Public Health Outcomes Framework 1938132983 Supporting information
This table shows that theProfileID
for the Public Health OutcomesFramework is 19. This can be used as an input for theindicators()
function:
profid<-19inds<- indicators(ProfileID=profid)print(inds[grepl("Healthy",inds$IndicatorName), c("IndicatorID","IndicatorName")])#> # A tibble: 2 x 2#> IndicatorID IndicatorName#> <int> <fct>#> 1 90362 A01a - Healthy life expectancy at birth#> 2 93505 A01a - Healthy life expectancy at 65
Healthy Life Expectancy at Birth has theIndicatorID
equal to 90362.
Finally, the data can be extracted using thefingertips_data()
function using thatIndicatorID
:
indid<-90362df<- fingertips_data(IndicatorID=indid,AreaTypeID=202)head(df)#> IndicatorID IndicatorName ParentCode ParentName AreaCode#> 1 90362 Healthy life expectancy at birth <NA> <NA> E92000001#> 2 90362 Healthy life expectancy at birth <NA> <NA> E92000001#> 3 90362 Healthy life expectancy at birth E92000001 England E12000001#> 4 90362 Healthy life expectancy at birth E92000001 England E12000002#> 5 90362 Healthy life expectancy at birth E92000001 England E12000003#> 6 90362 Healthy life expectancy at birth E92000001 England E12000004#> AreaName AreaType Sex Age CategoryType#> 1 England England Male All ages <NA>#> 2 England England Female All ages <NA>#> 3 North East region Region Male All ages <NA>#> 4 North West region Region Male All ages <NA>#> 5 Yorkshire and the Humber region Region Male All ages <NA>#> 6 East Midlands region Region Male All ages <NA>#> Category Timeperiod Value LowerCI95.0limit UpperCI95.0limit#> 1 <NA> 2009 - 11 63.02647 62.87787 63.17508#> 2 <NA> 2009 - 11 64.03794 63.88135 64.19453#> 3 <NA> 2009 - 11 59.71114 59.19049 60.23179#> 4 <NA> 2009 - 11 60.76212 60.39880 61.12544#> 5 <NA> 2009 - 11 60.84033 60.38649 61.29417#> 6 <NA> 2009 - 11 62.60207 62.07083 63.13332#> LowerCI99.8limit UpperCI99.8limit Count Denominator Valuenote RecentTrend#> 1 NA NA NA NA <NA> <NA>#> 2 NA NA NA NA <NA> <NA>#> 3 NA NA NA NA <NA> <NA>#> 4 NA NA NA NA <NA> <NA>#> 5 NA NA NA NA <NA> <NA>#> 6 NA NA NA NA <NA> <NA>#> ComparedtoEnglandvalueorpercentiles ComparedtoRegionvalueorpercentiles#> 1 Not compared Not compared#> 2 Not compared Not compared#> 3 Worse Not compared#> 4 Worse Not compared#> 5 Worse Not compared#> 6 Similar Not compared#> TimeperiodSortable Newdata Comparedtogoal Timeperiodrange#> 1 20090000 <NA> <NA> 3y#> 2 20090000 <NA> <NA> 3y#> 3 20090000 <NA> <NA> 3y#> 4 20090000 <NA> <NA> 3y#> 5 20090000 <NA> <NA> 3y#> 6 20090000 <NA> <NA> 3y
Please see the vignettes for information on use.
browseVignettes("fingertipsR")
- Please note that the ‘fingertipsR’ project is released with aContributor Code ofConduct.By contributing to this project, you agree to abide by its terms.
- License:GPL-3
About
R package to interact with Public Health England’s Fingertips data tool