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)
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
The new value to replace the entry.
- file
A character string with the file name to read the metadata from. The file format should be either "json" or "rds".
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 theMetadata
object, returningNULL
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 aMetadata
object.show(Metadata)
: Prints the metadata entries.