[R] convert a splus randomforest object to R

Liaw, Andy andy_liaw at merck.com
Tue Aug 9 21:12:20 CEST 2011


You really need to follow the suggestions in the posting guide to get the best help from this list.  

Which versions of randomForest are you using in S-PLUS and R?  Which version of R are you using?  When you restore the object into R, what does str(object) say?  Have you also tried dump()/source() as the R Data Import/Export manual suggests?

Andy 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Zhiming Ni
> Sent: Tuesday, August 02, 2011 8:11 PM
> To: r-help at r-project.org
> Subject: [R] convert a splus randomforest object to R
> 
> Hi,
>  
> I have a randomforest object "cost.rf" that was created in splus 8.0,
> now I need to use this trained RF model in R. So in Splus, I 
> dump the RF
> file as below
>  
> data.dump("cost.rf", file="cost.rf.txt", oldStyle=T) 
> 
> then in R, restore the dumped file,
> 
> library(foreign)
> 
> data.restore("cost.rf.txt")
> 
> it works fine and able to restore the "cost.rf" object. But when I try
> to pass a new data through this randomforest object using predict()
> function, it gives me error message.
> 
> in R:
> 
> library(randomForest)
> set.seed(2211)
> 
> pred <- predict(cost.rf, InputData[ , ])
> 
> Error in object$forest$cutoff : $ operator is invalid for 
> atomic vectors
> 
> 
> Looks like after restoring the dump file, the object is not compatible
> in R. Have anyone successfully converted a splus randomforest 
> object to
> R? what will be the appropriate method to do this?
> 
> Thanks in advance.
> 
> Jimmy
> 
> ==========================================
> This communication contains information that is confidential, 
> and solely for the use of the intended recipient. It may 
> contain information that is privileged and exempt from 
> disclosure under applicable law. If you are not the intended 
> recipient of this communication, please be advised that any 
> disclosure, copying, distribution or use of this 
> communication is strictly prohibited. Please also immediately 
> notify SCAN Health Plan at 1-800-247-5091, x5263 and return 
> the communication to the originating address.
> Thank You.
> ==========================================
> 
> 	[[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.
> 
Notice:  This e-mail message, together with any attachme...{{dropped:11}}



More information about the R-help mailing list