metadata2 | R Documentation |
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 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
x |
Object. |
which |
|
value |
|
... |
Additional arguments. |
metadata2()
: Metadata. Returns NULL
on which
match failure, similar
to attr()
and metadata()
.
metadata2<-()
: Modified object.
Internally slots into attributes()
.
Attribute is also accessible via attr(object, which)
.
Requires that object extends Annotated
class.
Internally slots into metadata()
.
Attribute is also accessible via metadata(object)[[which]]
.
Updated 2021-10-14.
## 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.