Create a package
Usage
package_create(
name = NULL,
title = NULL,
private = FALSE,
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",
...
)Arguments
- name
(character) the name of the new dataset. It must be between 2 and 100 characters long and contain only lowercase alphanumeric characters, - and _, for example 'warandpeace'
- title
(character) the title of the dataset (optional, default: same as name)
- private
(logical) whether the dataset is private (optional, default:
FALSE). IfTRUE, you must give a value forowner_org.(character) the name of the dataset's author (optional)
(character) the email address of the dataset's author (optional)
- maintainer
(character) the name of the dataset's maintainer (optional)
- maintainer_email
(character) the email address of the dataset's maintainer (optional)
- license_id
(license id string) The id of the dataset's license. See license_list() for available values (optional)
- notes
(character) a description of the dataset (optional)
- package_url
(character) a URL for the dataset's source (optional)
- version
(string, no longer than 100 characters) (optional)
- state
(character) the current state of the dataset, for example 'active' or 'deleted' (optional, default: 'active'). Only active datasets appear in search results and other lists of datasets. If you lack permission to change the state of the dataset, the function ignores this parameter.
- type
(character) the type of the dataset (optional). IDatasetForm plugins link to different dataset types. They provide custom behaviour for handling these types
- resources
(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)- extras
(list of dataset extra dictionaries) The dataset's extras (optional). Extras are arbitrary (key: value) metadata items for datasets. Each extra dictionary must have keys 'key' (a string) and 'value' (a string)
- relationships_as_object
(list of relationship dictionaries) See
package_relationship_createfor the format of relationship dictionaries (optional)- relationships_as_subject
(list of relationship dictionaries) See
package_relationship_createfor the format of relationship dictionaries (optional)- groups
(data.frame) the groups to which the dataset belongs. Each row must have one or more of the following columns that 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(). See example (optional)- owner_org
(character) the id of the dataset's owning organization. See
organization_list()ororganization_list_for_userfor available values (optional)- 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)
Examples
if (FALSE) { # \dontrun{
# 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"))
# include a group
# package_create("brownbear", groups = data.frame(id = "some-id"))
} # }
