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.


Build Status Coverage Status

CRAN Status Badge CRAN Total Downloads CRAN Monthly Downloads

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

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/fingertips-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> <fctr>                                                      
#> 1       90362 0.1i - Healthy life expectancy at birth: the average number~
#> 2       92543 "2.05ii - Proportion of children aged 2-2\u00bdyrs offered ~

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
#>   Indic~ Indi~ Pare~ Pare~ Area~ Area~ Area~ Sex   Age   Cate~ Cate~ Time~
#>    <int> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1  90362 0.1i~ <NA>  <NA>  E920~ Engl~ Coun~ Male  All ~ <NA>  <NA>  2009~
#> 2  90362 0.1i~ <NA>  <NA>  E920~ Engl~ Coun~ Fema~ All ~ <NA>  <NA>  2009~
#> 3  90362 0.1i~ E920~ Engl~ E120~ Nort~ Regi~ Male  All ~ <NA>  <NA>  2009~
#> 4  90362 0.1i~ E920~ Engl~ E120~ Nort~ Regi~ Male  All ~ <NA>  <NA>  2009~
#> 5  90362 0.1i~ E920~ Engl~ E120~ York~ Regi~ Male  All ~ <NA>  <NA>  2009~
#> 6  90362 0.1i~ E920~ Engl~ E120~ East~ Regi~ Male  All ~ <NA>  <NA>  2009~
#> # ... with 12 more variables: 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

News

fingertipsR 0.1.5

  • 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.1.8 by Sebastian Fox, 16 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], 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


See at CRAN