Hadley Wickham — written Dec 10, 2012 — source
All R objects have attributes, which can be queried and modified with the
attr
method. Rcpp also provides a names()
method for the commonly used
attribute: attr("names")
. The following code snippet illustrates these
methods:
Here’s what the object we created in C++ looks like in R:
a b c 1 2 3 attr(,"my-attr") [1] "my-value" attr(,"class") [1] "my-class"
tags: basics
Tweet