[R] R.oo in R-3.0.1

Grach, Alexander alexander.grach at credit-suisse.com
Wed Aug 21 23:47:17 CEST 2013


Fellow R users, 

I'm trying to upgrade from 2.11 to 3.0.1. I have a legacy S3 class
defining method "DAILY" within one of our "in-house" packages using
R.oo. This method does not seem to  get 'resolved' under 3.0.1,
specifically the following does not work:

----CODE WITHIN PACKAGE (e.g. MyPackage)-----
setConstructorS3("MyTestClass", function(name = NULL, ...) {
    this <- extend(RObject(), "MyTestClass", .units = NULL, .numUnits =
NULL, .name = name)    #RObject extends Object and adds couple of simple
methods
    return(this)
})

setMethodS3("DAILY", "MyTestClass", function(this, ...) {
    print("In DAILY.MyTestClass")
})

setMethodS3("DAILY2", "MyTestClass", function(this, ...) {
    print("In DAILY2.MyTestClass")
})

setMethodS3("Daily", "MyTestClass", function(this, ...) {
    print("In Daily.MyTestClass")
})

----CONSOLE---------------------------
> library(MyPackage)
> MyTestClass$DAILY()
Error in MyTestClass$DAILY() : could not find function "DAILY"
> DAILY.MyTestClass()
[1] "In DAILY.MyTestClass"
> MyTestClass$DAILY2()
[1] "In DAILY2.MyTestClass"
> MyTestClass$Daily()
[1] "In Daily.MyTestClass"
--------------------------------------------

Any ideas as to why MyTestClass$DAILY() fails under 3.0.1 and what is
the best way to fix this?? I can always change the method name, yet I
wouldn't know what other methods might have similar issues..  This all
worked fine in 2.11. 
Also - if I "source" this code it works  fine. 

Many thanks, 
Alex



============================================================================================================= 
This material has been prepared by individual sales and/or trading personnel and does not 
constitute investment research.  Please follow the attached hyperlink to an important disclaimer: 
http://www.credit-suisse.com/americas/legal/salestrading 
============================================================================================================= 


=============================================================================== 
Please access the attached hyperlink for an important el...{{dropped:4}}



More information about the R-help mailing list