set_resource: Set resource metadata

Description Usage Arguments See Also Examples

Description

New properties are added and existing properties are replaced (or deleted if NULL). If set, properties override the defaults returned by get_resource.

Usage

1
2
3
4
set_resource(.data, name, path, profile, title, description, format, mediatype,
  encoding, schema, bytes, hash, sources, licenses, ...)

set_resource(.data) <- value

Arguments

.data

Object to modify (typically a data.frame).

name

(character) Resource name.

path

(character) URLs or paths relative to the data package directory (see data-resource/path-data-in-files).

profile

(character) Custom resource profile (see https://specs.frictionlessdata.io/profiles/).

title

(character) Human-readable title.

description

(character) Human-readable description.

format

(character) Output format (e.g. "csv", "json").

mediatype

(character) Mediatype/mimetype of the output (e.g. "text/csv", "application/json").

encoding

(character) Character encoding of the output (see http://www.iana.org/assignments/character-sets/character-sets.xhtml).

schema

(named list) See schema.

bytes

(integer) Size of the output file in bytes.

hash

(character) MD5 hash of the output file.

sources

(list) See source.

licenses

(list) See license.

...

(name = value) Additional properties.

value

(named list) Resource metadata (typically a call to resource).

See Also

Other resource functions: get_package, get_resource, resource, set_resources

Examples

1
2
3
4
5
6
7
8
9
x <- set_resource(
  data.frame(id = 1L, value = 1.1),
  title = "Example data",
  path = "data/example.csv"
)
get_resource(x)
x <- data.frame(id = 1L, value = 1.1)
set_resource(x) <- resource(title = "Example data", path = "data/example.csv")
get_resource(x)

ezwelty/dpkg documentation built on May 30, 2019, 7:19 a.m.