[R] lm(), na.exclude and predict()
    Nurnberg-LaZerte 
    mail at fwr.on.ca
       
    Sat Aug  9 03:41:59 CEST 2003
    
    
  
I'm trying to get predict.lm() to return an NA for each NA row in it's input vector, so the output is the same length as the input. 
I thought that using na.action=na.exclude with lm() would do that. But apparently not ??
df <- data.frame(x=c(NA,1,2,3,NA),y=c(0,2,3,4,0))
tl <- lm(y~x,df,na.action=na.exclude)
predict.lm(tl,data.frame(x=c(2.5,NA,3,4,5)))
  1   3   4   5
3.5 4.0 5.0 6.0
Any suggestions?
Bruce
    
    
More information about the R-help
mailing list