Discussion:
[R] Loading a rda file for predicton
TJUN KIAT TEO
2014-10-13 13:37:38 UTC
Permalink
I tried this

--------------------------------------------------------------------------------------------
fit<-glm(Pred~Pressure+MissingStep, data = Test, family="binomial")

save(fit,file="pred.rda")

pred<-load("pred.rda")


predict(pred,Testsamp,type="response")

------------------------------------------------------------------------------------

But got this error message

no applicable method for 'predict' applied to an object of class "character"

What did I do wrong?


Tjun Kiat


[[alternative HTML version deleted]]
Peter Langfelder
2014-10-13 19:43:42 UTC
Permalink
see help(load) and pay particular attention to what the function
returns: the names of the loaded objects, not the object(s)
themselves.

You have to use

predict(fit,Testsamp,type="response")

since the load() created a variable 'fit' (same name as the one saved).

HTH

Peter
Post by TJUN KIAT TEO
I tried this
--------------------------------------------------------------------------------------------
fit<-glm(Pred~Pressure+MissingStep, data = Test, family="binomial")
save(fit,file="pred.rda")
pred<-load("pred.rda")
predict(pred,Testsamp,type="response")
------------------------------------------------------------------------------------
But got this error message
no applicable method for 'predict' applied to an object of class "character"
What did I do wrong?
Tjun Kiat
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Loading...