When designing and implementing object-oriented applications in R, problems concerning generic functions and reference variables often occur. It is currently not clear how to create generic functions in a robust way such that a new package will be compatible with existing or future packages. This will become an important problem as more and more packages are made available. As a functional language, R does not provide methods for programming with references as all arguments to functions are copied by value. However, there are situations where it is useful or even necessary to pass arguments by references. In this paper we present the package R.oo, which overcomes these problems. In addition to a way for automatically creating generic functions in the background and a transparent way of using references, it also provides a foundation for designing and implementing object-oriented applications in a robust way. In this context, we also suggest a draft of a coding convention intended to bring additional structure to the source code. The package also extends the current exception handling mechanism in R such that exception objects can be caught based on their class.
[1]
John M. Chambers,et al.
Programming With Data
,
1998
.
[2]
James Gosling,et al.
The Java Language Specification, 3rd Edition
,
2005
.
[3]
J. R. Koehler,et al.
Modern Applied Statistics with S-Plus.
,
1996
.
[4]
Ross Ihaka,et al.
Lexical Scope and Statistical Computing
,
2000
.
[5]
Brian D. Ripley,et al.
Modern Applied Statistics with S-Plus Second edition
,
1997
.
[6]
Andrew Shalit,et al.
The Dylan Reference Manual: The Definitive Guide to the New Object-Oriented Dynamic Language
,
1996
.