dataset_df: Create a new dataset_df object

View source: R/dataset_df.R

dataset_dfR Documentation

Create a new dataset_df object

Description

The dataset_df constructor creates the objects of this class, which are semantically rich, modern data frames inherited from tibble::tibble.

Usage

dataset_df(
  ...,
  identifier = c(eg = "http://example.com/dataset#"),
  var_labels = NULL,
  units = NULL,
  concepts = NULL,
  dataset_bibentry = NULL,
  dataset_subject = NULL
)

as_dataset_df(
  df,
  identifier = c(eg = "http://example.com/dataset#"),
  var_labels = NULL,
  units = NULL,
  concepts = NULL,
  dataset_bibentry = NULL,
  dataset_subject = NULL,
  ...
)

is.dataset_df(x)

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

is_dataset_df(x)

Arguments

...

The vectors (variables) that should be included in the dataset.

identifier

Defaults to c(eg="http://example.com/dataset#"), which should be changed to the permanent identifier of the dataset. For example, if your dataset will be released with the Digital Object Identifier (DOI) ⁠https;//doi.org/1234⁠, you should use a short prefixed identifier like c(obs="https://doi.org/1234#"), which will resolve to the rows being identified as https://doi.org/1234#1...https://doi.org/1234#n.

var_labels

The long, human readable labels of each variable.

units

The units of measurement for the measured variables.

concepts

The linked concepts of the variables, attributes, or constants.

dataset_bibentry

A list of bibliographic references and descriptive metadata about the dataset as a whole created with datacite or dublincore.

dataset_subject

The subject of the dataset, see subject.

df

A data.frame to be converted to dataset_df.

x

A dataset_df object for S3 methods.

Details

To check if an object has the class dataset_df use is.dataset_df.

print is the method to print out the semantically rich data frames created with the constructor of dataset_df.

summary is the method to summarise these semantically rich data frames.

For more details, please check the vignette("dataset_df", package = "dataset") vignette.

Value

dataset_df is the constructor of this type, it returns an object inherited from a data frame with semantically rich metadata.

is.dataset_df returns a logical value (if the object is of class dataset_df.)

Examples

my_dataset <- dataset_df(
  country_name = defined(
    c("AD", "LI"),
    concept = "http://data.europa.eu/bna/c_6c2bb82d",
    namespace = "https://www.geonames.org/countries/$1/"
  ),
  gdp = defined(
    c(3897, 7365),
    label = "Gross Domestic Product",
    unit = "million dollars",
    concept = "http://data.europa.eu/83i/aa/GDP"
  ),
  dataset_bibentry =  dublincore(
    title = "GDP of Andorra And Lichtenstein",
    description = "A small but semantically rich datset example.",
    creator = person("Jane", "Doe", role = "cre"),
    publisher = "Open Data Institute",
    language = "en")
 )

# Use standard methods, like print, summary, head, tail
print(my_dataset)
head(my_dataset)
tail(my_dataset)

# Check class:
is.dataset_df(my_dataset)

# To check the bibliographic metadata of a dataset,
# use as_dublincore for DCTERMS:
as_dublincore(my_dataset)

# ... and as_datacite for DataCite:
as_datacite(my_dataset)

dataset documentation built on June 8, 2025, 10:15 a.m.