[Rd] "is.qr" definition (PR#465)

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Wed, 1 Mar 2000 15:43:18 +0100 (MET)


>>>>> "JonR" == J C Rougier <J.C.Rougier@durham.ac.uk> writes:

    JonR> Might it be possible to tighten the definition of "is.qr".  I
    JonR> noticed that after I mistakenly typed

    JonR> example(lm) # make lm object named lm.D9
    JonR>  qr.Q(lm.D9)

    JonR> which exhausted the heap memory and produced two warning
    JonR> messages.  As an object of class "lm" has a "qr" component,
    JonR> "is.qr" failed to detect that "lm.D9" was not a "qr" object.
indeed.
yes, it should be tightened.

    JonR> The obvious thing might be to tighten the definition of "is.qr",

    JonR> perhaps

    JonR> "is.qr" <- function(x) all(c("qr", "rank", "qraux", "pivot") %in%
    JonR> names(x))

Just checked: 
 S-plus 5.1 checks for  qr and qraux only (but not just for the presence of
 the names, also !is.null(.) as we now do for $qr.

It makes sense to have this a FAST function since it's called quite a few
times in some calculations... maybe change current
    is.qr <- function(x) is.null(x$qr)
to
    is.qr <- function(x) is.null(x$qr) && !is.null(x$rank) && !is.null(x$qraux)

The current behavior is "according to documentation" so that would have to
be updated as well.

    JonR> And may I add my congratulations to the core group.

thank you 

Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._