Bruce LaZerte
2003-Aug-07 14:35 UTC
[R] predict(lm(etc.), some_data) -> "numeric envir arg not of length one " ???
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
Reasonably Related Threads
- [StructurizeCFG] Trouble with branches out of a loop
- Testing REST webservices? (Not Rails)
- RSpec for testing REST webservices? (Not Rails)
- Samba shows error NT Status: STATUS_OBJECT_NAME_NOT_FOUND when copying 10GB file using robocopy when ecryptfs file system shared using samba
- Samba shows error NT Status: STATUS_OBJECT_NAME_NOT_FOUND when copying 10GB file using robocopy when ecryptfs file system shared using samba