I've got a data frame with two numeric variables, df$flow and df$flow1.

> tl <- lm(flow~flow1,df,na.action=na.exclude)
> tlo <- loess(flow~flow1,df,na.action=na.exclude)

Both loess and a simple linear model fit the data well. 
summary(tl) and summary(tlo) seem reasonable. As do plots such as: 
plot(predict(tl),df$flow)
plot(predict(tlo),df$flow)

I want to replace missing values of  df$flow from df$flow1:

> p <- is.na(df$flow) 
> df$flow[p] <- predict(tl,df$flow1[p])
Error in eval(expr, envir, enclos) : numeric envir arg not of length one
???

> df$flow[p]<- predict(tlo,df$flow1[p])
This loess prediction works however.

Could someone explain the linear model's "numeric envir arg not of length one" error 
for me?

Thanks in advance ...
Bruce L.
__________________________________________
Bruce LaZerte 
Grandview Lake in Muskoka
Baysville, Ontario, Canada

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to