Technique/SAP HANA2011. 11. 29. 13:30

Dealing with R and HANA
Alvaro Tejada Galindo Active Contributor Silver: 500-1,499 points
Business Card
Company: SAP Labs
Posted on Nov. 28, 2011 05:03 PM in Analytics, Beyond SAP, In-Memory Business Data Management, Open Source

 
 

First things first...what's "R"? Simply put...is a programming language and software environment for statistical computing and graphics. More infomation can be found here R on Wikipedia

 

I have code in many programming languages, some of them very commercial, and some of them little known, but I got say, that from all, "R" is one of the most weird and awesome languages I have ever played with...and it has an amazing repository of custom add-ons.

 

If you have read the HANA Pocketbook you will realize that there's a reference to "R" in the page 59. Now, that kind of integration between "R" and HANA haven't been developed yet, but it doesn't mean we can get our hands dirty doing some research and development.

 

What I did for this example was to simply show the information of my Analytic View on HANA and exported as an CSV file. From there, it's easy to import it into "R" and start doing some nice things. (The idea is that we should be able to code "R" straight in the HANA environment...or at least that's how I think it's going to be...)

 

image

 

image

 

image

 

The first example that we're going to build on "R" is a simple Pie graphic, using the information from the FORCURAM and CARRNAME fileds.

 

image

 

In this example, we're basically reading the CSV file, including the header. And doing an aggregation of the two fields we want to interact with. After that, it's just a matter of pass the values, the names and call the pie.

 

image

 

Next example is a little bit more complex...and uses a custom package call Word Clouds

 

image

 

Here, we have to load the required libraries, read the CSV file, do the aggregation, create a matrix with the aggregation values, sort the matrix, create a new vector, get it's length, create an array containing the names and finally assign the values and call the wordcloud graphic method...

 

image

 

Hope you like it...and stay tuned for more "R"...

 

Alvaro Tejada Galindo  Active Contributor Silver: 500-1,499 points is a Development Expert, Scripting Languages Geek, Programming books author, Geek Comics author and SAP Mentor Alumni.



http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/27548%3Futm_source%3Dtwitterfeed%26utm_medium%3Dtwitter%26utm_campaign%3DFeed%253A+SAPNetworkWeblogs+%2528SAP+Network+Weblogs%2529
Posted by AgnesKim