[R] Loading a rda file for predicton

Peter Langfelder peter.langfelder at gmail.com
Mon Oct 13 21:43:42 CEST 2014


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 <teotjunk at 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 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.



More information about the R-help mailing list