This package is a part of our open-source R pipeline to download and clean public data related to health and social care. The aim is to provide analysts, primarily at the Health Foundation, with clean and ready for analysis data.
monstR - making ONS tables readable is a package that queries the Office for National Statistics (ONS) API to download data. It can be used to retrieve publically available data and meta data from the ONS.
ons_available_datasets()
returns information about available datasetsons_available_versions()
returns information about available dataset versionsons_available_editions()
returns information about available dataset editionsons_download()
downloads the specified dataPlease note that the ONS API that this package relies on is in beta and it might change.
If you have cloned a local copy of the repo, you should be able to load it using devtools
library(devtools) setwd("{location of monstR repo}") devtools::load_all()
or to install direct from Github
remotes::install_github("HFAnalyticsLab/monstR", build_vignettes = TRUE )
This is an example of how to download weekly mortality data by region. Note that this will create folders and download data.
monstr_pipeline_defaults() %>% # Uses the monstr 'standards' for location and format
ons_datasets_setup() %>%
ons_dataset_by_id("weekly-deaths-region") %>%
ons_download(format="csv") %>%
monstr_read_file() %>%
monstr_clean() %>%
monstr_write_clean(format="all")
You can find the help pages at https://hfanalyticslab.github.io/monstR/.
This is a package under active development and we would love for you to contribute or flag any issues you might find.
You can ask questions or flag a bug by filing an issue. We are more likely to be able to help you if we can reproduce your issue. The reprex
package is a good way of producing a minimal reproducible package and So you’ve been asked to make a reprex will help you get started.
We aim to make the documentation as comprehensive as possible. Please contribute examples or suggest improvements to the documentation.
If you have written a function that you think should be added to the package, or improved an existing function, please submit a pull request that includes:
tests/testthat
.The monstrR Open Data Pipeline is designed to work well with tidyverse and in particular within pipelines created by the %>%
pipe operator. With this in mind, most functions take a data structure in the first argument and return a data structure which has been augmented in some way. Typically this is metadata about the actual data, although once the data has been cleaned it can be accessed using monstr_data(metadata)
to get at a tidyverse tibble of the data.
This project is licensed under the MIT License.
Thanks goes to these wonderful people (emoji key):
Emma Vestesson 🤔 🖋 📖 |
Tom Jemmett 🐛 |
JohnHC86 🐛 |
Neale Swinnerton 💻 |
fiona-grimm 🤔 🎨 |
SimonCRUK 🐛 |
Zoe Turner 🐛 |
This project follows the all-contributors specification. Contributions of any kind welcome!