lunes, 28 de noviembre de 2011

Dealing with R and HANA


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...)






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




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.




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




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...




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


Greetings,

Blag.

2 comentarios:

Steve Oldner dijo...

Okay, weird got my attention. Thanks for the post and research!

Alvaro "Blag" Tejada Galindo dijo...

Glad you like it Steve -:) And...research is my job, so expect more goodies from now on -;)

Greetngs,

Blag.