Learn R Programming

dataset (version 0.2.1)

dataset_export: 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)

Value

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

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.

See Also

dataset

Examples

Run this code
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"))

# \donttest{
read.csv(file.path(tempdir(), "my_iris.csv"), skip=20)
read.csv(file.path(tempdir(), "my_iris.csv"))
# }

Run the code above in your browser using DataLab