Re: [Rd] promptClass misses methods

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Fri 01 Dec 2006 - 10:37:46 GMT

>>>>> "RossB" == Ross Boylan <ross@biostat.ucsf.edu> >>>>> on Thu, 30 Nov 2006 22:29:06 -0800 writes:

    RossB> I've had repeated problems with promptClass missing
    RossB> methods, usually telling me a class has no methods
    RossB> when it does.

    RossB> In my current case, I've defined an S4 class
    RossB> "mspathCoefficients" with a print method
    RossB> setMethod("print", signature(x="mspathCoefficients"),     RossB> function(x, ...) { # etc

You should *not* define "print" methods for S4 classes; rather you should define "show" methods.

    RossB> The file promptClass creates has no methods in it.
>> showMethods(classes="mspathCoefficients")

    RossB> Function: initialize (package methods)
    RossB> .Object="mspathCoefficients" (inherited from:
    RossB> .Object="ANY")

so it's just inherited from "ANY"

    RossB> Function: print (package base)     RossB> x="mspathCoefficients"

that's the one

    RossB> Function: show (package methods)
    RossB> object="mspathCoefficients"
    RossB>  (inherited from: object="ANY")
so it's just inherited from "ANY"

Ross, it would really be more polite to your readers if you followed the posting guide and posted complete fully-reproducible code...

>> getGeneric("print")

    RossB> standardGeneric for "print" defined from package     RossB> "base"

    RossB> function (x, ...)  standardGeneric("print")
    RossB> <environment: 0x84f2d88> Methods may be defined for
    RossB> arguments: x


    RossB> I've looked through the code for promptClass, but     RossB> nothing popped out at me.

    RossB> It may be relevant that I'm running under ESS in
    RossB> emacs.  However, I get the same results running R
    RossB> from the command line.

    RossB> Can anyone tell me what's going on here?  This is
    RossB> with R 2.4, and I'm not currently using any namespace     RossB> for my definitions.

[and not a package either?]

I'm very willing to look at this, once
you've provided what the posting guide asks for, see above.

Regards,
Martin



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Dec 01 21:53:32 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 01 Dec 2006 - 20:30:53 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.