Skip to content

monstR is an R package that queries the Office for National Statistics (ONS) API to download data. monstR makes it easy to retrieve publicly available ONS data and meta data.

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

HFAnalyticsLab/monstR

Repository files navigation

monstR - making ONS tables readable

All Contributors

R-CMD-check

Project Status: in progress

Project Description

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.

Overview

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 datasets
  • ons_available_versions() returns information about available dataset versions
  • ons_available_editions() returns information about available dataset editions
  • ons_download() downloads the specified data

Please note that the ONS API that this package relies on is in beta and it might change.

Installation

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 )

Examples

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")

Resources

Online documentation

You can find the help pages at https://hfanalyticslab.github.io/monstR/.

Questions and bug reports

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.

Contributing to the package development

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:

  • the new/amended function(s) with code and roxygen tags (with examples)
  • a new section in the appropriate vignette that describes how to use the new function
  • corresponding tests in directory tests/testthat.

Design Principles

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.

Authors

License

This project is licensed under the MIT License.

Contributors ✨

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!

About

monstR is an R package that queries the Office for National Statistics (ONS) API to download data. monstR makes it easy to retrieve publicly available ONS data and meta data.

Topics

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published