[R] R.oo in R-3.0.1

Grach, Alexander alexander.grach at credit-suisse.com
Thu Aug 22 22:55:00 CEST 2013


Dear Henrik, 

Thanks for getting back to me. 
Apologies  - have resolved the problem myself. The package in question
has quite a bit of legacy code written by others and as it appeared had
explicit library() calls inside the source code on the top level. After
removing those calls things started working. In fact I have realized
this by creating a small package containing just this code in question
and seeing this work just fine, so that prompted me to look further into
other source files in the original package etc. 

There is no issue to look into at this point as the package works just
fine. Thanks again.

Best, 
Alex

-----Original Message-----
From: henrik.bengtsson at gmail.com [mailto:henrik.bengtsson at gmail.com] On
Behalf Of Henrik Bengtsson
Sent: Thursday, August 22, 2013 3:27 PM
To: Grach, Alexander
Cc: r-help at r-project.org
Subject: Re: [R] R.oo in R-3.0.1

Hi, R.oo author here:

This looks like a possible namespace issues, which might have gone
under the radar if you have only used R v2.11.x until now.  Could you
forward me your MyPackage test package so I can troubleshoot/reproduce
(I think the answer is in your DESCRIPTION/NAMESPACE file).

/Henrik


On Wed, Aug 21, 2013 at 2:47 PM, Grach, Alexander
<alexander.grach at credit-suisse.com> wrote:
> 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}}
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

============================================================================================================= 
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