[Rd] termplot (PR#2687)

Mark.Bravington at csiro.au Mark.Bravington at csiro.au
Wed Mar 26 00:32:53 MET 2003


#       r-bugs at r-project.org

`termplot' bombs if the original dataset contains NAs in the predictors,
even if these were ignored during fitting:

test> bug.data_ data.frame( x=c(1:3, NA), y=runif( 4))
test> lm.tpbug_ lm( y~x, data=bug.data)
test> termplot( lm.tpbug)
Error in xy.coords(x, y, xlabel, ylabel, log) : 
        subscript out of bounds

A simple fix seems to be add the commented line below, near the top of
`termplot':

    n.tms <- ncol(tms <- as.matrix(if (se) 
        terms$fit
    else terms))
    mf <- model.frame(model)
    if (is.null(data)) 
        data <- eval(model$call$data, envir)
    if (is.null(data)) 
        data <- mf
    data <- data[ dimnames( tms)[[1]], ] # MVB
    nmt <- colnames(tms)
  
cheers
Mark

Mark Bravington
CSIRO (CMIS)
PO Box 1538
Castray Esplanade
Hobart
TAS 7001

phone (61) 3 6232 5118
fax (61) 3 6232 5012
Mark.Bravington at csiro.au 

--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = 
 major = 1
 minor = 6.2
 year = 2003
 month = 01
 day = 10
 language = R

Windows 2000 Professional (build 2195) Service Pack 3.0

Search Path:
 .GlobalEnv, ROOT, package:handy, package:debug, mvb.session.info,
package:mvbutils, package:tcltk, Autoloads, package:base



More information about the R-devel mailing list