Re: R-beta: problem with locfit

Thomas Lumley (thomas@biostat.washington.edu)
Thu, 26 Mar 1998 09:26:05 -0800 (PST)


Date: Thu, 26 Mar 1998 09:26:05 -0800 (PST)
From: Thomas Lumley <thomas@biostat.washington.edu>
To: Clive Loader <clive@bell-labs.com>
Subject: Re: R-beta: problem with locfit
In-Reply-To: <351A73D5.F9AD0E00@bell-labs.com>

On Thu, 26 Mar 1998, Clive Loader wrote:

> 
> A second problem is that the R (0.61.1) model.extract() function differs
> from the
> S version, and the cens argument won't be interpreted properly. Adding
> the following
> modified model.extract() to the locfit/R/lfrsup.r file should work...
> 

Here is a more general solution to the model.extract problem, rather than
forcing developers to edit model.extract every time they introduce a new
argument.

model.extract<- function (frame, component) 
{
        component <- as.character(substitute(component))
        rval <- switch(component, response = model.response(frame), 
                offset = model.offset(frame), weights = frame$"(weights)", 
                start = frame$"(start)")
        if (is.null(rval)) {
                name <- paste("frame$\"(", component, ")\"", 
                        sep = "")
                rval <- eval(parse(text = name)[1])
        }
        if (length(rval) == nrow(frame)) 
                names(rval) <- attr(frame, "row.names")
        else if (is.matrix(rval) && nrow(rval) == nrow(frame)) {
                t1 <- dimnames(rval)
                dimnames(rval) <- list(attr(frame, "row.names"), 
                        t1[[2]])
        }
        return(rval)
}




Thomas Lumley
------------------------------------------------------+------
Biostatistics		: "Never attribute to malice what  :
Uni of Washington	:  can be adequately explained by  :
Box 357232		:  incompetence" - Hanlon's Razor  :
Seattle WA 98195-7232	:				   :
------------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._