Learn R Programming

datapackage (version 0.2.1)

new_dataresource: Create a new Data Resource

Description

Create a new Data Resource

Usage

new_dataresource(
  name,
  title = NULL,
  description = NULL,
  path = NULL,
  format = NULL,
  mediatype = NULL,
  encoding = NULL,
  bytes = NULL,
  hash = NULL,
  ...
)

Value

Returns a dataresource object which is a list with the properties of the Data Resource.

Arguments

name

The name of the Data Resource.

title

The title of the Data Resource.

description

The description of the Data Resource.

path

the path of the Data Resource

format

the format of the Data Resource

mediatype

the mediatype of the Data Resource

encoding

the encoding of the Data Resource

bytes

the number of bytes of the Data Resource

hash

the hash of the Data Resource

...

additional arguments are added as additional properties. It is checked if these are valid.

Examples

Run this code
dir <- tempdir()
dp <- new_datapackage(dir, name = "test-package")

res <- new_dataresource(name = "iris")
dp_title(res) <- "The Iris Data Set"
dp_encoding(res) <- "UTF-8"
dp_mediatype(res) <- "text/csv"

# resource adds a resource if it doesn't yet exist or updates
# an existing resource
dp_resource(dp, "iris") <- res

# \dontshow{
file.remove(file.path(dir, "datapackage.json"))
file.remove(dir)
# }


Run the code above in your browser using DataLab