dataset_export: Export a dataset

View source: R/dataset_export.R

dataset_exportR Documentation

Export a dataset

Description

Export a dataset together with reference (DataCite and Dublin Core) metadata.

Usage

dataset_export(ds, file, filetype = "csv", ...)

dataset_export_csv(ds, file)

Arguments

ds

A dataset object.

file

A (path to) a file where to export the dataset object.

filetype

Currently only 'csv' is implemented.

...

Further parameters to be passed on to exporting functions. See details.

Details

This function is a wrapper around the exporting functions.It implements file exports in a way that the resulting exported file contains reference metadata.
dataset_export_csv is a wrapper around utils::write.csv. Use ... to pass on argument to that function.

Value

The function write a desired file on disc and does not return anything.

See Also

dataset

Examples

my_iris_dataset <- dataset(
     x = iris,
     Dimensions = NULL,
     Measures = c("Sepal.Length", "Sepal.Width",  "Petal.Length", "Petal.Width" ),
     Attributes = "Species",
     Title = "Iris Dataset"
)

my_iris_dataset <- dublincore_add(
     x = my_iris_dataset,
     Creator = person("Edgar", "Anderson", role = "aut"),
     Publisher = "American Iris Society",
     Source = "https://doi.org/10.1111/j.1469-1809.1936.tb02137.x",
     Date = 1935,
     Language = "en"
)

dataset_export_csv(my_iris_dataset, file = file.path(tempdir(), "my_iris.csv"))


read.csv(file.path(tempdir(), "my_iris.csv"), skip=20)
read.csv(file.path(tempdir(), "my_iris.csv"))


dataset documentation built on March 31, 2023, 10:24 p.m.