Use package API to access object attributes
Issue #2
closed
It is generally a very bad idea to use attr
to access (or attr<-
to set) attributes of any class you do not own. I noticed at least one place where attr(x, "index")
is used instead of index(x)
or time(x)
. This is a very bad practice because it circumvents the zoo and xts APIs.
There is no guarantee that the index of a zoo or xts object must be an attribute and/or named "index". This is true of all the other characteristics of the object classes as well. So you should strongly consider changing all uses of attr
to use the provided API functions instead.
Comments (2)
-
repo owner -
repo owner - changed status to closed
Code updated
- Log in to comment
Good point, will fix shortly.