Dynamically handles metadata assignment and extraction in a similar fashion for both S3 and S4 objects.
metadata2(x, which, ...) metadata2(x, which, ...) <- value # S4 method for ANY,character metadata2(x, which) # S4 method for Annotated,character metadata2(x, which) # S4 method for ANY,character metadata2(x, which) <- value # S4 method for Annotated,character metadata2(x, which) <- value
x | Object. |
---|---|
which |
|
value |
|
... | Additional arguments. |
metadata2()
: Metadata. Returns NULL
on which
match failure, similar
to attr()
and metadata()
.
metadata2<-()
: Modified object.
Updated 2020-01-18.
Internally slots into attributes()
.
Attribute is also accessible via attr(object, which)
.
Requires that object extends Annotated
class,
which supports metadata()
.
Internally slots into metadata()
.
Attribute is also accessible via metadata(object)[[which]]
.
#> [1] "B"#> [1] "B"## S4 (extending Annotated) ==== x <- DataFrame() metadata2(x, which = "A") <- "B" metadata2(x, which = "A")#> [1] "B"#> [1] "B"