Learn R Programming

statswalesr

statswalesr is a package for downloading datasets and their associated metadata from StatsWales. This functionality is limited to datasets that are available through the OData feed. You can check this by navigating to your desired dataset, scrolling to the bottom, and checking that the “Dataset” link is available under the Open Data tab.

Installation

statswalesr is now on CRAN. To install:

install.packages("statswalesr")

You can install the development version of statswalesr from GitHub with:

# install.packages("devtools")
devtools::install_github("jamie-ralph/statswalesr")

Usage

The code below extracts data about aircraft movement at Cardiff airport and the associated metadata.

library(statswalesr)

metadata <- statswales_get_metadata("tran0003")

df <- statswales_get_dataset("tran0003")

You can also search for datasets based on key terms. For example, to search for datasets related to farming and agriculture:

library(dplyr)

farming_datasets <- statswales_search(c("farm*", "agri*"))

glimpse(farming_datasets)
## Rows: 29
## Columns: 2
## $ Description_ENG <chr> "Children's services: Welfare/health summary", "Childr~
## $ Dataset         <chr> "care0021", "care0022", "agri0200", "agri0201", "agri0~

Welsh language

All statswalesr functions support Welsh language downloads using the language argument:

welsh_df <- statswales_get_dataset("tran0003", language = "welsh")

Copy Link

Version

Install

install.packages('statswalesr')

Monthly Downloads

190

Version

0.2.0

License

MIT + file LICENSE

Maintainer

Jamie Ralph

Last Published

April 3rd, 2022

Functions in statswalesr (0.2.0)

statswales_get_metadata

Retrieve metadata of a dataset from StatsWales
statswales_get_dataset

Retrieves a dataset from the StatsWales OData API
statswales_search

Search StatsWales datasets