Skip to contents

The Metadata S3 class holds information, such as name, date, author and file, as a named list with elements of length one. The Metadata is essentially a list therefore list methods are also applicable.

Usage

Metadata(entries = list())

# S3 method for class 'Metadata'
validate_object(x)

# S3 method for class 'Metadata'
length(x)

# S3 method for class 'Metadata'
names(x)

# S3 method for class 'Metadata'
x[i]

# S3 method for class 'Metadata'
x[i] <- value

# S3 method for class 'Metadata'
x[[i]]

# S3 method for class 'Metadata'
x[[i]] <- value

# S3 method for class 'Metadata'
save(x, file = "metadata.json")

# S3 method for class 'Metadata'
read(x, file)

# S3 method for class 'Metadata'
show(x)

# S3 method for class 'Metadata'
as.data.table(x)

as.Metadata(value)

Arguments

entries

A named list of metadata entries as elements. Default is an empty list. Elements must be of type character, numeric or POSIXt and must have length 1.

x

A Metadata object.

i

A numeric or character vector with the index or name of the entry to replace.

value

An object that highly depends on the method. Check the specific method documentation for details.

file

A character string with the file name to read the metadata from. The file format should be either "json" or "rds".

Value

A Metadata S3 class object which is fundamentally a named list with metadata entries.

Details

If not given, elements name, author, date and file are set to NA_character_, NA_character_, current system time and NA_character_, respectively.

Methods (by generic)

  • validate_object(Metadata): Validates the Metadata object, returning NULL if valid.

  • length(Metadata): Returns the length of the metadata entries.

  • names(Metadata): Returns the names of the metadata entries.

  • [: Subsets the metadata entries.

  • `[`(Metadata) <- value: Replaces metadata entries.

  • [[: Extracts a single metadata entry.

  • `[[`(Metadata) <- value: Replaces a single metadata entry.

  • save(Metadata): Saves the metadata to a file.

  • read(Metadata): Reads metadata from a file, returning a Metadata object.

  • show(Metadata): Prints the metadata entries.

  • as.data.table(Metadata): Converts the Metadata object to a data.table object.

Functions

  • as.Metadata(): Converts a named list, data.table or data.frame to a Metadata object. When value is a data.table or data.frame, it must have columns "name" and "value", where "name" contains the metadata entry names and "value" contains the corresponding values.