Skip to contents

Create a dataset

Usage

as_dataset(
  x,
  author,
  title,
  publisher = NULL,
  year = NULL,
  identifier = NULL,
  description = NULL,
  version = NULL,
  datasubject = NULL,
  language = NULL,
  datasource = NULL,
  rights = NULL
)

# S3 method for class 'data.frame'
as_dataset(
  x,
  author,
  title,
  publisher = NULL,
  year = NULL,
  identifier = NULL,
  description = NULL,
  version = NULL,
  datasubject = NULL,
  language = NULL,
  datasource = NULL,
  rights = NULL
)

dataset(
  x,
  author,
  title,
  identifier = NULL,
  publisher = NULL,
  year = NULL,
  version = NULL,
  datasubject = NULL,
  description = NULL,
  language = NULL,
  datasource = NULL,
  rights = NULL,
  ...
)

is.dataset(x)

# S3 method for class 'dataset'
print(x, n, ...)

# S3 method for class 'dataset'
summary(object, ...)

Arguments

x

An R object that contains the data of the dataset (a data.frame or inherited from data.frame), for example, tibble::tibble(), tsibble::tsibble(), data.table::data.table().

author

A single person or a vector of persons as authors, declared with person.

title

The title of the dataset.

publisher

The organisation or person that publishes the dataset. If left empty (NULL), receives the DataCite standard value ':tba', or to be announced later.

year

The year of the creation of the dataset. If left empty (NULL), the current year.

identifier

The permanent identifier, for example, the DOI of the dataset. If left empty (NULL), receives the DataCite standard value ':tba', or to be announced later.

description

The optional Description property as an attribute to an R object.

version

The version of the dataset. If left empty (NULL), defaults to '0.1.0'

datasubject

The subject of the data frame, as a subject type.

language

The primary language of the dataset, for example 'eng'. Defaults to NULL that sets it to the unassigned value ':unas'.

datasource

The source of the dataset, DCMI: Source, which corresponds to a relatedItem in the DataCite vocabulary. We use datasource instead of source to avoid naming conflicts with the base R source() function.

rights

Any rights information for this resource. The property may be repeated to record complex rights characteristics. Free text, defaults to ":unas" for unassigned values. See rights.

...

Further arguments passed on to generic methods like summary(x, ...).

n

Number of rows to print.

object

an object for which a summary is desired.

Value

A dataset object, which is a data.frame or inherited object with rich metadata.

Details

For further information, see the vignette("dataset", package = "dataset") vignette.

See also

Examples

ds <- dataset(iris,
        title = "The iris Dataset",
        author = c(
           person(family ="Anderson",
           given ="Edgar",
           role = "aut")
           ),
         identifier = "https://doi.org/10.1111/j.1469-1809.1936.tb02137.x",
         year = "1935",
         version = "1.0",
         description = "The famous dataset that is distributed with R.",
         url = "https://en.wikipedia.org/wiki/Iris_flower_data_set",
         resourceType = "Dataset"
         )