use RinR

TIBCO Spotfire is tool for data visualisation.
I think that TERR “TIBCO Enterprise Runtime for R” is cool. This module allows us to develop in open source R.
It can develop not only serve-side, but also client-side.
So, I can use my local R environment to make data function.
If I use RinR, I don’t need think about server side R environment.
I wrote sample code about machine learning using local e1071.
To use RinR, “REValuate” function is need to communicate local R and TERR.

* This is simple sample.
Make svm model from input dataset and predict (classification) value using same table.
Like this….

library(RinR);
REValuate({ library(e1071);
                     table1 <- inTable; #read data for train.
                     target <- factor( target ); # i.e. Species in iris-dataset.
                     table1$target <- target; # join data
                     model.svm <- svm( target ~., data = table1 ); # make classification model.
                     res <- predict( model.svm, inTable );
                     output <- data.frame( table1, res ); # return result another data table.
                   }
                    , data=c("inTable", "target") # argument for local R env
               )

In Spotfire’s input tab, I set “inTable” is table(data that using prediction), and set “target” is column( data for classification ).
Then in output tab, I set “output” is table.

All preparation is done.
Run the script.
I use iris dataset for test, and get same result with R.
I think it’s useful function, because datafunction is stored in library and any other user can use the function without coding.
But, to develop function, need some tricky technics I think.
Someone who has more good practice, please advice me ;-).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s