CKAN allows only sysadmin users to create, update, and delete vocabularies.
Each helper wraps the matching /api/3/action/vocabulary_* endpoint.
Usage
vocabulary_list(
url = get_default_url(),
key = get_default_key(),
as = "list",
...
)
vocabulary_show(
id,
include_datasets = FALSE,
url = get_default_url(),
key = get_default_key(),
as = "list",
...
)
vocabulary_create(
name,
tags = NULL,
url = get_default_url(),
key = get_default_key(),
as = "list",
...
)
vocabulary_update(
id,
name = NULL,
tags = NULL,
url = get_default_url(),
key = get_default_key(),
as = "list",
...
)
vocabulary_delete(
id,
url = get_default_url(),
key = get_default_key(),
as = "list",
...
)Arguments
- url
Base URL to use. Default: https://demo.ckan.org/. See also
ckanr_setupandget_default_url.- key
A privileged CKAN API key. Default: your key set with
ckanr_setup- as
(character) One of list (default), table, or json. Parsing with the table option uses
jsonlite::fromJSON(..., simplifyDataFrame = TRUE), which attempts to parse data to data.frame's when possible. The result can vary from a vector, list or data.frame. (required)- ...
Extra curl arguments. The function passes them to
verb-POST(optional)- id
(character or
ckan_vocabulary) Vocabulary ID or name. You can also pass an existingckan_vocabularyobject.- include_datasets
(logical) The function returns datasets owned by the vocabulary. Only applies to
vocabulary_show().- name
(character) Unique name of the vocabulary.
(list) Optional list of tag objects. Each object contains at least a
namefield. See https://docs.ckan.org/en/latest/api/ for the full structure.
Examples
if (FALSE) { # \dontrun{
ckanr_setup(url = "https://demo.ckan.org/", key = getOption("ckan_demo_key"))
vocab_name <- sprintf("demo_vocab_%s", sample.int(1e6, 1))
vocab <- vocabulary_create(name = vocab_name)
vocabulary_show(vocab$id)
vocabulary_update(vocab, name = paste0(vocab_name, "_updated"))
vocabulary_list()
vocabulary_delete(vocab)
} # }
