Type: | Package |
Title: | Easily Extract Data from 'StatsWales' |
Version: | 0.2.0 |
Description: | Download data from 'StatsWales' into R. Removes the need for the user to write their own loops when parsing data from the 'StatsWales' API. Provides functions for datasets (http://open.statswales.gov.wales/en-gb/dataset) and metadata (http://open.statswales.gov.wales/en-gb/discover/metadata) endpoints. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
Imports: | jsonlite, httr, curl, dplyr, rlang |
RoxygenNote: | 7.1.1 |
Suggests: | testthat |
NeedsCompilation: | no |
Packaged: | 2022-04-03 14:12:21 UTC; james |
Author: | Jamie Ralph [aut, cre] |
Maintainer: | Jamie Ralph <jamesryanralph@outlook.com> |
Repository: | CRAN |
Date/Publication: | 2022-04-03 19:30:02 UTC |
Retrieves a dataset from the StatsWales OData API
Description
statswales_get_dataset
returns a dataframe from
StatsWales using a dataset id. The
print_progress
argument can be set to TRUE
to keep track of
progress when extracting a large dataset.
Usage
statswales_get_dataset(id, print_progress = FALSE, language = "english")
Arguments
id |
A dataset id. Must be a single string. |
print_progress |
logical. Should progress be printed in the console? |
language |
A string. Returns the dataset in either English ('english') or Welsh ('welsh'). The default is English. |
Value
If the dataset id is valid, the function will return the requested dataset in a dataframe. If the id is not valid, the function will return an error.
Examples
data <- statswales_get_dataset("hlth0515")
Retrieve metadata of a dataset from StatsWales
Description
statswales_get_metadata
returns a dataframe containing metadata from
StatsWales using a dataset id.
Usage
statswales_get_metadata(id, language = "english")
Arguments
id |
A dataset id as a string |
language |
A string. Returns the metadata in either English ('english') or Welsh ('welsh'). The default is English. |
Value
If the dataset id is valid, the output will be the requested metadata in a dataframe. If the id is not valid, the function will return an HTTP error.
Examples
metadata <- statswales_get_metadata("hlth0515")
Search StatsWales datasets
Description
statswales_search
returns a dataframe of dataset titles and IDs from
StatsWales, based on the user's
text input.
Usage
statswales_search(search_text, language = "english")
Arguments
search_text |
A vector of search terms. |
language |
A string. Returns the metadata in either English ('english') or Welsh ('welsh'). The default is English. |
Value
A dataframe of StatsWales dataset titles and IDs.
Examples
crops_datasets <- statswales_search("*crops*")