Skip to content

Latest commit

 

History

History
129 lines (96 loc) · 5.77 KB

README.md

File metadata and controls

129 lines (96 loc) · 5.77 KB

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

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/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