From ripley at stats.ox.ac.uk  Tue Jun 10 08:03:36 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 10 Jun 2008 07:03:36 +0100 (BST)
Subject: [Rd] Error in "getClass" when calling the function "show"
In-Reply-To: <27d1e6020806092123v16e25f38hf1739d486fda232d@mail.gmail.com>
References: <27d1e6020806092123v16e25f38hf1739d486fda232d@mail.gmail.com>
Message-ID: <alpine.LFD.1.10.0806100659010.28008@gannet.stats.ox.ac.uk>

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



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