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.
statswalesr is now on CRAN. To install:
install.packages("statswalesr")
You can install the development version of statswalesr from GitHub with:
# install.packages("devtools")
::install_github("jamie-ralph/statswalesr") devtools
The code below extracts data about aircraft movement at Cardiff airport and the associated metadata.
library(statswalesr)
<- statswales_get_metadata("tran0003")
metadata
<- statswales_get_dataset("tran0003") df
You can also search for datasets based on key terms. For example, to search for datasets related to farming and agriculture:
library(dplyr)
<- statswales_search(c("farm*", "agri*"))
farming_datasets
glimpse(farming_datasets)
## Rows: 29
## Columns: 2
## $ Description_ENG <chr> "Children's services: Welfare/health summary", "Childr~
## $ Dataset <chr> "care0021", "care0022", "agri0200", "agri0201", "agri0~
All statswalesr functions support Welsh language downloads using the language argument:
<- statswales_get_dataset("tran0003", language = "welsh") welsh_df