Skip to content
Prev 795 / 398502 Next

R-beta: problem with locfit

On Thu, 26 Mar 1998, Clive Loader wrote:

            
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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._