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

One thought on “use RinR

  1. Hello There,

    You make learning and reading addictive. All eyes fixed on you. Thank you being such a good and trust worthy guide.

    When I’m developing JavaScript code, I try to make use of everything I can to monitor variables, troubleshoot errors, and perform test-use cases. Currently, when I use alert messages or post variables to JavaScript objects, they somehow get saved in the background and can’t be cleared in the current session. The result: I run the program once, get an alert message and data. Tweak the program a little, re-run, now I get 2 alert messages and the data may or may not override. If I re-run, I get 3 alert messages… if keeps going.
    It’s at the point where if I have to develop JavaScript code in a dashboard, I have to completely close and re-open the session to make sure I clear the background resources. This is very time consuming.
    I look forward to see your next updates.

    Obrigado,
    Abhiram

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s