I have created an object in R that contains several attributes. How can I easily access them?
I can do:
attr(x, attributeName)
or:
probably there is no built-in function that is counter part of . in C++, but you can define it like this:
> `%.%` <- function(o, a) attr(o, as.character(substitute(a))) > x <- 1 > attr(x, "orz") <- 2 > x%.%orz [1] 2