Re: [R] Calling a stored model within the predict() function

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sun, 27 Apr 2008 08:39:14 -0400

Read the last line of every message to r-help.

On Sat, Apr 26, 2008 at 7:14 PM, Jim_S <virtualreal_at_gmail.com> wrote:
>
> Hi all,
>
> First of all, I'm a novice R user (less that a week), so perhaps my code
> isn't very efficient.
>
> Using the MBoost package I created a model using the following command and
> saved it to a file for later use:
>
> model <- gamboost(fpfm,data=SampleClusterData,baselearner="bbs") # Creating
> a model
> save(model,file="model.RData") # Saving a model
>
>
> After this, during a new R session, I want to deploy this model:
>
> setwd("Q:/Program Files/R/library/mboost/data")
> NewData <- read.table("NewData.txt",header=TRUE,sep=,",") #Calling a new
> data set
> setwd("Q:/Program Files/R/library/mboost")
> model <- load("model.rdata") # Loading the model
>
> This won't work. When I check the content of the 'model' object, the only
> screen output I see is :
>
> "model
> [1]model"
>
> ...and that the actual file size from 'model.rdata' is exactly 4,100 kb (is
> this a limit?!)
>
>
> Then I try to call this model object with the predict() function:
>
> CRPredict <- predict(model, newdata= SampleClusterData) # Make the
> predictions
>
> This results in the following error message:
>
> "Error in UseMethod("predict") : no applicable method for "predict" "
>
> Is the a correct way to store and call a model or is it only possible to
> create & deploy a model during the same R session?
>
> Thanks!
>
> Jim
>
>
>
> --
> View this message in context: http://www.nabble.com/Calling-a-stored-model-within-the-predict%28%29-function-tp16918111p16918111.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



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. Received on Sun 27 Apr 2008 - 12:42:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 27 Apr 2008 - 13:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive