R-beta: problem with locfit

Thomas Lumley thomas at biostat.washington.edu
Thu Mar 26 18:26:05 CET 1998


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



More information about the R-help mailing list