[R] Loading a rda file for predicton

2014-10-13 Thread 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@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.


Re: [R] Loading a rda file for predicton

2014-10-13 Thread Peter Langfelder
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



On Mon, Oct 13, 2014 at 6:37 AM, TJUN KIAT TEO teotj...@hotmail.com wrote:
 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@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.

__
R-help@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.