This one is almost a philosophical question: is it bad to access and/or set slots of S4 objects directly using @
?
I have always been told it was bad practic
In general it is good programming practice to separate the content of an object from the interface, see this wikipedia article. The idea is to have the interface separate from the implementation, in that way the implementation can change considerably, without affecting any of the code that interfaces with that code, e.g. your script. Therefore, using @
creates less robust code that is less likely to work in a few years time. For example in the sp
-package mentioned by @mdsummer the implementation of how polygons are stored might change because of speed or progressing knowledge. Using @
, your code breaks down, using the interface your code works still. Except ofcourse if the interface also changes. But changes to the implementation are much more likely than interface changes.