Fingertips Data for Public Health

Fingertips (< http://fingertips.phe.org.uk/>) contains data for many indicators of public health in England. The underlying data is now more easily accessible by making use of the API.


BuildStatus CoverageStatus

CRAN StatusBadge CRAN TotalDownloads CRAN MonthlyDownloads

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

CRAN

Get the latest released, stable version from CRAN:

install.packages("fingertipsR")

With devtools

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

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

From zip

Download this repository from GitHub and either build from source or do the following, that also requires devtools:

source <- devtools:::source_pkg("C:/path/to/fingertipsR-master")
install(source)

Base R instructions

To install the package without the use of CRAN or devtools, download the .tar.gz file and then run:

install.packages(path_to_file, repos = NULL, type="source")

Where path_to_file would represent the full path and file name.

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)
#> # A tibble: 6 x 4
#>   ProfileID ProfileName                        DomainID DomainName        
#>       <int> <chr>                                 <int> <chr>             
#> 1        19 Public Health Outcomes Framework    1000049 Overarching indic~
#> 2        19 Public Health Outcomes Framework    1000041 Wider determinant~
#> 3        19 Public Health Outcomes Framework    1000042 Health improvement
#> 4        19 Public Health Outcomes Framework    1000043 Health protection 
#> 5        19 Public Health Outcomes Framework    1000044 Healthcare and pr~
#> 6        19 Public Health Outcomes Framework 1938132983 Supporting inform~

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")])
#> # A tibble: 2 x 2
#>   IndicatorID IndicatorName                                               
#>         <int> <fct>                                                       
#> 1       90362 0.1i - Healthy life expectancy at birth: the average number~
#> 2       92543 2.05ii - Proportion of children aged 2-2½yrs offered ASQ-3 ~

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)
head(df)
#> # A tibble: 6 x 24
#>   IndicatorID IndicatorName     ParentCode ParentName AreaCode AreaName   
#>         <int> <chr>             <chr>      <chr>      <chr>    <chr>      
#> 1       90362 0.1i - Healthy l~ <NA>       <NA>       E920000~ England    
#> 2       90362 0.1i - Healthy l~ <NA>       <NA>       E920000~ England    
#> 3       90362 0.1i - Healthy l~ E92000001  England    E120000~ North East~
#> 4       90362 0.1i - Healthy l~ E92000001  England    E120000~ North West~
#> 5       90362 0.1i - Healthy l~ E92000001  England    E120000~ Yorkshire ~
#> 6       90362 0.1i - Healthy l~ E92000001  England    E120000~ East Midla~
#> # ... with 18 more variables: AreaType <chr>, Sex <chr>, Age <chr>,
#> #   CategoryType <chr>, Category <chr>, Timeperiod <chr>, Value <dbl>,
#> #   LowerCI95.0limit <dbl>, UpperCI95.0limit <dbl>,
#> #   LowerCI99.8limit <dbl>, UpperCI99.8limit <dbl>, Count <dbl>,
#> #   Denominator <dbl>, Valuenote <chr>, RecentTrend <chr>,
#> #   ComparedtoEnglandvalueorpercentiles <chr>,
#> #   Comparedtosubnationalparentvalueorpercentiles <chr>,
#> #   TimeperiodSortable <int>

Use

Please see the vignettes for information on use.

browseVignettes("fingertipsR")

More information

ropensci_footer

News

fingertipsR 0.2.1

  • deprivation_decile() for AreaTypeID = 7 (General Practice) now only contains 2015 deprivation deciles. 2010 to 2012 have been removed

  • bug fix around entering vectors of IndicatorIDs and ProfileIDs into fingertips_data() function

fingertipsR 0.2.0 (12/11/2018)

  • select_indicators() fixed for selecting more than one indicator

  • deprivation_decile() now includes MSOA (AreaTypeID = 3)

  • removed deprecated inequalities argument from fingertips_data()

  • increased speed of indicators() function (and therefore select_indicators() and other functions that rely on it)

  • IndicatorName field in indicators() table returns short name rather than long name

fingertipsR 0.1.9

  • New field "Compared to goal" in fingertips_data()

  • New field name "Compared to [AreaType]" in fingertips_data()

  • Improved tests

fingertipsR 0.1.8 (05/07/2018)

  • fingertips_data function adapted for "New data" field in API

fingertipsR 0.1.7 (27/05/2018)

  • nearest_neighbours() modified to include measure parameter - so user can get 15 CIPFA nn for upper tier local authorities

  • data retrieval functions now use local proxy settings

fingertipsR 0.1.6 (03/05/2018)

  • nearest_neighbours() function added

  • indicator_order() function added

fingertipsR 0.1.5 (06/02/2018)

  • corrected fingertips_stats to give accurate stats

fingertipsR 0.1.4 (03/02/2018)

  • modifications to the fingertipsR paper

  • badges added to README

  • package approved by ropensci

  • fingertips_stats function added to give high level statistics of indicators in Fingertips

  • indicator_areatypes now links to API rather than built in dataset

  • indicators_unique function provides unique table of indicators

fingertipsR 0.1.3 (5/10/2017)

  • API structure updated to include 99.8 and 95 confidence intervals. Reflected in the outputs of fingertips_data. NOTE earlier versions of the package will not work anymore because of the underlying change in the API structure

fingertipsR 0.1.2 (27/9/2017)

  • fixed issue with rank and some fingertips_data queries

  • removed dependency on tidyjson as a result of its removal from CRAN

fingertipsR 0.1.1 (7/9/2017)

  • select_indicators() allows user to point and click to select indicators

  • stringsAsFactors parameter available in fingertips_data()

  • automatically filter for CategoryType = FALSE in fingertips_data() - this can be set to TRUE if needed

  • rank of area and polarity of indicator returned from fingertips_data() where rank = TRUE (polarity can also be found in indicator_metadata())

  • fingertips_redred highlights which areas are statistically different to comparator and trending in the wrong direction

  • category_types() lookup function to support ordering where categories exist (eg, deprivation decile)

  • areatypes_by_indicators() to help users determine which indicators are available for each area type (and vice versa)

  • A new vignette demonstrating how some of the new functions can be used

fingertipsR version 0.1.0 (17/6/2017)

This package allows the user to retrieve tables of:

  • indicators, domains and profiles and their relationships to each other
  • data related to indicators for geographies where the data are already available on the Fingertips website
  • indicator metadata
  • deprivation data for geographies that are available on the Fingertips website

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("fingertipsR")

0.2.1 by Sebastian Fox, 19 days ago


https://fingertips.phe.org.uk, https://github.com/ropensci/fingertipsR


Report a bug at https://github.com/ropensci/fingertipsR/issues


Browse source code at https://github.com/cran/fingertipsR


Authors: Sebastian Fox [aut, cre] , Julian Flowers [aut, ctb] , Simon Thelwall [ctb] , Duncan Gormansway [ctb] , Carl Ganz [ctb] , David Whiting [ctb] , Crown Copyright 2018 [cph]


Documentation:   PDF Manual  


GPL-3 license


Imports curl, dplyr, DT, httr, jsonlite, miniUI, purrr, readr, shiny, shinycssloaders

Suggests ggplot2, knitr, pander, rmarkdown, testthat


Imported by fingertipscharts.


See at CRAN