From Martin Maechler <maechler@stat.math.ethz.ch>  Wed Aug 18 09:48:04 1999
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Wed, 18 Aug 1999 10:48:04 +0200
Subject: diag(); feature freeze; please beta-test..
In-Reply-To: <Pine.GSO.3.96.990818091901.648B-100000@laplace> (message from
 Jonathan Rougier on Wed, 18 Aug 1999 09:26:42 +0100 (BST))
References: <Pine.GSO.3.96.990818091901.648B-100000@laplace>
Message-ID: <199908180848.KAA03018@sophie.ethz.ch>

>>>>> On Wed, 18 Aug 1999 09:26:42 +0100 (BST), Jonathan Rougier <J.C.Rougier@durham.ac.uk> said:

    JonR> I would like to suggest a slight modification to diag().  In the
    JonR> case where x is a matrix with both row names and column names the
    JonR> same, it would be reasonable if the resulting vector also had
    JonR> those names.  I often use diag() on variance matrices, where this
    JonR> modification is helpful.

    JonR> The modification requires replacing 

    JonR> if (is.matrix(x) && nargs() == 1) 
    JonR>    return(c(x)[1 + 0:(min(dim(x)) - 1) * (dim(x)[1] + 1)])

    JonR> the first two lines, with something like

    JonR> if (is.matrix(x) && nargs() == 1) {
    JonR>   y <- c(x)[1 + 0:(min(dim(x)) - 1) * (dim(x)[1] + 1)]
    JonR>   if (!is.null(nms <- dimnames(x)) && all(nms[[1]]==nms[[2]]))
    JonR>     names(y) <- nms[[1]]
    JonR>   return(y)
    JonR> }

    JonR> Just a thought,  Jonathan.

    JonR> Jonathan Rougier                       Science Laboratories
    JonR> Department of Mathematical Sciences    South Road
    JonR> University of Durham                   Durham DH1 3LE


This seems like a good idea [ and I think I vaguely remember that I would
			      have wanted that myself, some time],
however,  R 0.65 is in ``feature freeze'' now
(and release date is scheduled for Aug.27 ..)

Yes, please ``everyone'' : 
Now is pre-tester time,
     Get "R-devel.tar.gz" from a CRAN site near you,
unpack and install {from source!!},
and send bug reports to R-core or R-devel,
*not* to R-bugs -- since bugs in non-released versions shouldn't make it
into the R repository I think.

{I hope to not forget to put the above diag() improvement into the next
  release after 0.65(.0)..}

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


diag(); feature freeze; please beta-test..
Martin Maechler