[R] S4 vs Reference Classes

Joseph Park jpark.us at att.net
Tue Sep 13 19:54:38 CEST 2011


   Hi, I'm looking for some guidance on whether to use
   S4 or Reference Classes for an analysis application
   I'm developing.
   I'm a C++/Python developer, and like to 'think' in OOD.
   I started my app with S4, thinking that was the best
   set of OO features in R. However, it appears that one
   needs Reference Classes to allow object methods to assign
   values (other than the .Object in the initialize method)
   to slots of the object.
   This is typically what I prefer: creating an object, then
   operating on the object (reference) calling object methods
   to access/modify slots.
   So I'm wondering what (dis)advantages there are in
   developing with S4 vs Reference Classes.
   Things of interest:
   Performance (i.e. memory management)
   Integration compatibility with R packages
   ??? other issues
   Thanks!


More information about the R-help mailing list