Re: [Rd] Rf_PrintValue problem with methods::show

2007-04-08 Thread Byron Ellis
Indeed, you run into the same problem when trying to use PrintValue in a package (say, for debugging purposes). I just have an implementation that uses GlobalEnv instead of BaseEnv though I'm not sure that it's necessarily the correct choice (though it has yet to do something I don't want). On 4/8

Re: [Rd] Rf_PrintValue problem with methods::show

2007-04-08 Thread Prof Brian Ripley
Simon, There are a couple of subtle issues here. As I wrote, PrintValue evaluates in the base environment, so sees only base functions. It is not clear to me that is the right place (why the base environment and not the base namespace, for example), and one might consider evaluating in R_Glo

Re: [Rd] Rf_PrintValue problem with methods::show

2007-04-08 Thread Simon Urbanek
Deepayan, don't mind my last mail - one shouldn't write e-mails before the first cup of coffee in the morning ;).. "methods" used to be excluded from the embedded startup (AFAIR), but that's no longer the case, so it must be something else. Sorry for the noise (I'm off to get the coffee :P

Re: [Rd] Rf_PrintValue problem with methods::show

2007-04-08 Thread Simon Urbanek
Deepayan, you fail to load the methods package, so you cannot use S4. Eval "library(methods)" first then everything is fine. Cheers, Simon On Apr 7, 2007, at 7:33 PM, Deepayan Sarkar wrote: > Hi, > > I think this is a bug (even though I can't find documentation > explicitly saying that it sho

Re: [Rd] Rf_PrintValue problem with methods::show

2007-04-08 Thread Prof Brian Ripley
Look at the definition of PrintValue: void PrintValue(SEXP s) { PrintValueEnv(s, R_BaseEnv); } That's not going to find show from R_BaseEnv. We need to get it from the methods namespace. On Sat, 7 Apr 2007, Deepayan Sarkar wrote: > Hi, > > I think this is a bug (even though I can't find

[Rd] Rf_PrintValue problem with methods::show

2007-04-07 Thread Deepayan Sarkar
Hi, I think this is a bug (even though I can't find documentation explicitly saying that it should work). Basically, Rf_PrintValue(obj) fails when 'obj' is an S4 object that should be printed using show() rather than print(). From the error message I'm guessing that the need to use show is detecte