Create a package
package_create(name = NULL, title = NULL, author = NULL,
author_email = NULL, maintainer = NULL, maintainer_email = NULL,
license_id = NULL, notes = NULL, package_url = NULL,
version = NULL, state = "active", type = NULL, resources = NULL,
tags = NULL, extras = NULL, relationships_as_object = NULL,
relationships_as_subject = NULL, groups = NULL, owner_org = NULL,
url = get_default_url(), key = get_default_key(), as = "list", ...)
(character) the name of the new dataset, must be between 2 and 100 characters long and contain only lowercase alphanumeric characters, - and _, e.g. 'warandpeace'
(character) the title of the dataset (optional, default: same as name)
(character) the name of the dataset's author (optional)
(character) the email address of the dataset's author (optional)
(character) the name of the dataset's maintainer (optional)
(character) the email address of the dataset's maintainer (optional)
(license id string) - the id of the dataset's license, see license_list() for available values (optional)
(character) a description of the dataset (optional)
(character) a URL for the dataset's source (optional)
(string, no longer than 100 characters) - (optional)
(character) the current state of the dataset, e.g. 'active' or 'deleted', only active datasets show up in search results and other lists of datasets, this parameter will be ignored if you are not authorized to change the state of the dataset (optional, default: 'active')
(character) the type of the dataset (optional), IDatasetForm plugins associate themselves with different dataset types and provide custom dataset handling behaviour for these types
(list of resource dictionaries) - the dataset's resources, see resource_create() for the format of resource dictionaries (optional)
(list of tag dictionaries) - the dataset's tags, see tag_create() for the format of tag dictionaries (optional)
(list of dataset extra dictionaries) - the dataset's extras (optional), extras are arbitrary (key: value) metadata items that can be added to datasets, each extra dictionary should have keys 'key' (a string), 'value' (a string)
(list of relationship dictionaries) - see package_relationship_create() for the format of relationship dictionaries (optional)
(list of relationship dictionaries) - see package_relationship_create() for the format of relationship dictionaries (optional)
(list of dictionaries) - the groups to which the dataset belongs (optional), each group dictionary should have one or more of the following keys which identify an existing group: 'id' (the id of the group, string), or 'name' (the name of the group, string), to see which groups exist call group_list()
(character) the id of the dataset's owning organization, see organization_list() or organization_list_for_user() for available values (optional)
Base url to use. Default: http://data.techno-science.ca. See
also ckanr_setup
and get_default_url
.
A privileged CKAN API key, Default: your key set with ckanr_setup
(character) One of list (default), table, or json. Parsing with table option
uses jsonlite::fromJSON(..., simplifyDataFrame = TRUE)
, which attempts to parse
data to data.frame's when possible, so the result can vary from a vector, list or
data.frame. (required)
Curl args passed on to POST
(optional)
# NOT RUN {
# Setup
ckanr_setup(url = "https://demo.ckan.org/", key = getOption("ckan_demo_key"))
# create a package
## Example 1
(res <- package_create("foobar4", author="Jane Doe"))
res$author
## Example 2 - create package, add a resource
(res <- package_create("helloworld", author="Jane DOe"))
# }
Run the code above in your browser using DataLab