[R] using RSperl with "tree" package

rachanaj at yahoo.com rachanaj at yahoo.com
Sun Nov 11 22:16:41 CET 2007


Hello,

I am trying to use the "tree" package in R with RSperl.

I have generated a regression tree using the "tree" package in R and saved it in a file say "RegTree_2.Rdata"

If I use the predict function from R command line, it works fine. However, I want to use it from within perl using RSperl. To do that, here is what I do,

my $regTree = "RegTree_2.Rdata";
my $tree = &R::load($regTree);
my $ans = &R::call("predict.tree", $tree, $_[0]);

On running my code, I get the following error:
Error in predict.tree("rtree_2", list("5031601", "GS0098", 0, "1", "1",  :
        not legitimate tree

Any help would be appreciated.

Thanks
-Rachana

--
This message was sent on behalf of rachanaj at yahoo.com at openSubscriber.com
http://www.opensubscriber.com/messages/r-help@stat.math.ethz.ch/topic.html



More information about the R-help mailing list