I have created an object in R that contains several attributes. How can I easily access them?
I can do:
attr(x, attributeName)
or:
attributes(x)$attributeName
but none of them is really convenient.
Is there a quicker way (like the dot in C++ or Java)?
Don’t use attributes for your object, use a list:
Of course, this might not work if you’re extending an existing object (e.g. vector), but in my experience it’s a generally better way to build objects.