[Rd] Error in "getClass" when calling the function "show"

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Jun 10 08:03:36 CEST 2008


showDefault has

     clDef <- getClass(class(object))

Looks like the showDefault code intended

     clDef <- getClass(class(object), .force=TRUE)

However, why are you calling show() on a non-S4 object?  I cannot see any 
advtanges in doing so.

On Tue, 10 Jun 2008, Laurent Gautier wrote:

> Dear List,
>
> Calling "show" on an object of class "summary.lm" gives:
> Error in getClass(class(object)) : "summary.lm" is not a defined class
>
> Is this a miss on my end ?
>
>
>> x <- seq(1, 10)
>> show(x)
> [1]  1  2  3  4  5  6  7  8  9 10
>> y <- runif(10)
>> fit <- lm(y ~ x)
>> show(fit)
>
> Call:
> lm(formula = y ~ x)
>
> Coefficients:
> (Intercept)            x
>    1.04938     -0.08869
>
>> show(summary(fit))
> Error in getClass(class(object)) : "summary.lm" is not a defined class
>> class(summary(fit))
> [1] "summary.lm"
>> class((fit))
> [1] "lm"
>> getClass("lm")
> Virtual Class
>
> No Slots, prototype of class "S4"
>
> Extends: "oldClass"
>
> Known Subclasses:
> Class "mlm", directly
> Class "aov", directly
> Class "glm", directly
> Class "maov", by class "mlm", distance 2
> Class "glm.null", by class "glm", distance 2
>> getClass("summary.lm")
> Error in getClass("summary.lm") : "summary.lm" is not a defined class
>>
>> sessionInfo()
> R version 2.7.0 Patched (2008-06-07 r45877)
> i686-pc-linux-gnu
>
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
>
> Laurent
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list