summary.default & is.recursive

About this list Date view Thread view Subject view Author view Other groups

Subject: summary.default & is.recursive
From: Paul Gilbert (pgilbert@bank-banque-canada.ca)
Date: Fri 09 Jul 1999 - 04:05:43 EST


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


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:05 EST