summary.default & is.recursive

Paul Gilbert pgilbert@bank-banque-canada.ca
Thu, 08 Jul 1999 14:05:43 -0400


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._