ckanr vignette

Scott Chamberlain

2019-10-11

Install

Stable version from CRAN

install.packages("ckanr")

Development version from GitHub

remotes::install_github("ropensci/ckanr")
library("ckanr")

Note: the default base CKAN URL is set to http://data.techno-science.ca/. You can change this using ckanr_setup(), or change the URL using the url parameter in each function call.

To set one or both, run:

# restores default CKAN url to http://data.techno-science.ca/
ckanr_setup() 
# Just set url
ckanr_setup(url = "http://data.techno-science.ca/")
# set url and key
ckanr_setup(url = "http://data.techno-science.ca/", key = "my-ckan-api-key")

Changes

changes(limit = 2, as = "table")[, 1:4]

List datasets

package_list(as = "table")

List tags

tag_list('aviation', as = 'table')

Show tags

Subset for readme brevity

tag_show('Aviation')

List groups

group_list(as = 'table')[, 1:3]

Show groups

Subset for readme brevity

group_show('communications', as = 'table')$users

Show a package

package_show('34d60b13-1fd5-430e-b0ec-c8bc7f4841cf', as = 'table')$resources[, 1:10]

Search for packages

out <- package_search(q = '*:*', rows = 2, as = "table")$results
out[, !names(out) %in% 'resources'][, 1:10]

Search for resources

resource_search(q = 'name:data', limit = 2, as = 'table')

Example of using a different CKAN API

The UK Natural History Museum

Website: https://data.nhm.ac.uk/

List datasets

Tags

list

show

Packages

search

show