From pgilbert@bank-banque-canada.ca  Thu Jul  8 19:05:43 1999
From: pgilbert@bank-banque-canada.ca (Paul Gilbert)
Date: Thu, 08 Jul 1999 14:05:43 -0400
Subject: summary.default & is.recursive
References: <199907071321.PAA16206@sophie.ethz.ch> <378361E6.5BF86D8C@bank-banque-canada.ca> <199907080634.IAA21541@sophie.ethz.ch> <3784BC8C.6801672@bank-banque-canada.ca> <199907081615.SAA08660@sophie.ethz.ch>
Message-ID: <3784E877.40D25BE9@bank-banque-canada.ca>

I'm moving this part of an on-going discussion to r-devel because I think I've
uncovered a bug:

>summary.default :  How is yours different from R's (I didn't try to find out)
>       If it has an advantage you should post to R-devel as a proposal

I did propose  it along time ago, but ... The fix was for a bug that Splus 3.2
and 3.3 have. It does not work properly with lists having an object with class
length greater than 1. I reported it to StatSci and it was suppose to get fixed
in 3.3 but didn't. I'm not sure about later versions. Having now just checked R,
I see that R's summary.default has been changed. But the problem does not occur
because another more serious incompatibility occurs first:

z <- 1:3
class(z) <- c("a", "b")

is.recursive(list(z, a=list(1:3)) )

R64.2:>   [1] FALSE
Splus3.3> [1] T


My change to summary.default was to fix the following warning in Splus3.2 and
3.3:

> summary.default(list(z, a=list(1:3)))
  Length Class    Mode
  3      a     numeric
a 1            list
Warning messages:
  Replacement length not a multiple of number of elements to replace in: sumry[
 i, 2] <- class(ii)

and consisted simply of changing

      sumry[i, 2] <- if (is.object(ii))
           class(ii)
to
   sumry[i, 2] <- if (is.object(ii))
        paste(class(ii), collapse=" ")

This may not be necessary in the current R version, but because of the above
error in is.recursive, that part of summary.default is not used now.


Paul Gilbert

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


summary.default & is.recursive
Paul Gilbert