[R] S4 classes?

Martin Maechler maechler at stat.math.ethz.ch
Wed Jun 2 10:44:57 CEST 2004


>>>>> "Spencer" == Spencer Graves <spencer.graves at pdf.com>
>>>>>     on Wed, 02 Jun 2004 01:32:17 -0700 writes:

    Spencer> The following example, extracted from pp. 38-42 of Chambers (1998) 
    Spencer> Programming with Data (Springer), works for me in S-Plus 6.2 but not R 
    Spencer> 1.9.0pat, which returns the indicated error messages: 

    >> setClass('track', representation(x="numeric", y="numeric"))
    Spencer> [1] "track"
    >> tr1 <- new("track", x=1:3, y=4:6)
    >> setMethod("plot",
    Spencer> + signature(x="track", y="missing"),
    Spencer> + function(x, y, ...)plot(x at x, x at y, ...)
    Spencer> + )
    Spencer> [1] "plot"
    >> plot(tr1)
    Spencer> Error in plot.window(xlim, ylim, log, asp, ...) :
    Spencer> need finite xlim values
    Spencer> In addition: Warning messages:
    Spencer> 1: no finite arguments to min; returning Inf
    Spencer> 2: no finite arguments to max; returning -Inf
    Spencer> 3: no finite arguments to min; returning Inf
    Spencer> 4: no finite arguments to max; returning -Inf

    Spencer> Am I missing something or is my copy of R 1.9.0pat corrupted?  

    Spencer> (This is under Windows 2000.) 

It works without a problem for me, both in R-1.9.0 or R-patched.

Did you try these commands from a "freshly started"   
'R --vanilla' ?
   {you will know how to do this ("R --vanila") in Windows ?}

Martin




More information about the R-help mailing list