[R] convert a splus randomforest object to R

Duncan Mackay mackay at northnet.com.au
Wed Aug 3 08:22:20 CEST 2011


Hi Jimmy

Years ago I think that Splus introduced an argument when dumping of 
old.style = T  or something similar to dump it into a form that could 
be read into R.
This may only be for data.frames etc not things like random forest objects

Regards

Duncan


Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email: home mackay at northnet.com.au


At 10:10 03/08/2011, you wrote:
>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.



More information about the R-help mailing list