metadata2: Metadata

Description Usage Arguments Value S3 class S4 class Note Examples

Description

Dynamically handles metadata assignment and extraction in a similar fashion for both S3 and S4 objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
metadata2(x, which, ...)

metadata2(x, which, ...) <- value

## S4 method for signature 'ANY,character'
metadata2(x, which)

## S4 method for signature 'Annotated,character'
metadata2(x, which)

## S4 replacement method for signature 'ANY,character'
metadata2(x, which) <- value

## S4 replacement method for signature 'Annotated,character'
metadata2(x, which) <- value

Arguments

x

Object.

which

character(1). A non-empty character string specifying which attribute is to be accessed. Note that positional numeric arguments are currently not allowed.

...

Additional arguments.

value

ANY. Metadata values to assign into slot, defined by which.

Value

S3 class

Internally slots into attributes(). Attribute is also accessible via attr(object, which).

S4 class

Requires that object extends Annotated class, which supports metadata().

Internally slots into metadata(). Attribute is also accessible via metadata(object)[[which]].

Note

Updated 2019-10-24.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## S3 ====
x <- data.frame()
metadata2(x, which = "A") <- "B"
metadata2(x, which = "A")
attr(x, which = "A")

## S4 (extending Annotated) ====
x <- S4Vectors::DataFrame()
metadata2(x, which = "A") <- "B"
metadata2(x, which = "A")
S4Vectors::metadata(x)[["A"]]

acidgenomics/transformer documentation built on Jan. 9, 2020, 11:34 a.m.