forked from ropensci/fingertipsR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
99 lines (69 loc) · 3.53 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
[![codecov](https://codecov.io/gh/ropensci/fingertipsR/branch/master/graph/badge.svg?token=MpVheRqaRo)](https://codecov.io/gh/ropensci/fingertipsR)
[![](https://badges.ropensci.org/168_status.svg)](https://github.com/ropensci/software-review/issues/168)
[![R build status](https://github.com/ropensci/fingertipsR/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/fingertipsR/actions)
# fingertipsR
This is an R package to interact with Public Health England's [Fingertips](http://fingertips.phe.org.uk/) 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:
```{r rOpenSci-install, eval=FALSE}
# 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](https://github.com/r-lib/remotes):
```{r gh-installation, eval = FALSE}
# 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:
```{r profiles example}
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:
```{r indicators example}
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`:
```{r fingertips_data example}
indid <- 90362
df <- fingertips_data(IndicatorID = indid, AreaTypeID = 202)
head(df)
```
## Use
Please see the vignettes for information on use.
```{r use, eval=FALSE}
browseVignettes("fingertipsR")
```
## More information
* Please note that the 'fingertipsR' project is released with a
[Contributor Code of Conduct](https://github.com/ropensci/fingertipsR/blob/master/CODE_OF_CONDUCT.md).
By contributing to this project, you agree to abide by its terms.
* License: [GPL-3](https://opensource.org/licenses/GPL-3.0)
[![ropensci\_footer](https://ropensci.org/public_images/ropensci_footer.png)](https://ropensci.org)