[R-pkg-devel] Creating Accessor Methods

Daniel Nüst daniel.nuest at uni-muenster.de
Thu Mar 10 16:48:04 CET 2016


Hi Glenn!

On 10/03/16 15:05, Glenn Schultz wrote:
> I have a package with to S4 classes (MBSCashFlow, REMICCashFlow and BondCashFlow) all of which contain the slot Duration.  I would like have an accessor Duration that would work on multiple signatures.  Is this possible?  I have checked my books, help, BioConductor tutorials and it appears that this is not possible.  Has anyone ever run into this situation?

I actually use a similar mechanism to extract values from different S4 
classes in my package, and it works quite well. So if I understand you 
right, the following code might help you to get closer to want you want:

https://github.com/52North/sos4R/blob/master/R/SOS-methods-accessor.R

I created methods for different signatures, see for example 
"sosObservedProperties".


Hope this helps,
Daniel

-- 
Daniel Nüst
Institute for Geoinformatics (ifgi),   University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 31962
http://ifgi.uni-muenster.de/~d_nues01        http://o2r.info



More information about the R-package-devel mailing list