dp_generate_dataresource: Generate Data Resource for a dataset

View source: R/dp_generate_dataresource.R

dp_generate_dataresourceR Documentation

Generate Data Resource for a dataset

Description

Generate Data Resource for a dataset

Usage

dp_generate_dataresource(
  x,
  name,
  path = paste0(name, getextension(format)),
  format = "csv",
  mediatype = getmediatype(format),
  use_existing = FALSE,
  categories_type = c("regular", "resource"),
  categorieslist = iscategorieslist(x),
  ...
)

Arguments

x

data.frame for which to generate the Data Resources.

name

name of the Data Resource

path

name of the file in which to store the dataset. This should be a path relative to the location of the directory in which the Data Package in which the Data Resource will be stored.

format

the data format in which the data is stored.

mediatype

mediatype of the data

use_existing

use existing field descriptors if present.

categories_type

how should categories be stored. See dp_generate_fielddescriptor.

categorieslist

does the data resource function as a categories list for fields in another data resource

...

Currently ignored

Value

Returns a Data Resource object.

Note that this function does not create the file at path. The export of the Data Resource is automatically set to CSV.

Examples

# generate an example dataset
dta <- data.frame(a = 1:3, b = factor(letters[1:3]))
resource <- dp_generate_dataresource(dta, "example")
print(resource)


djvanderlaan/datapackage documentation built on June 12, 2025, 2:44 a.m.