# Prediction model with HANA and R

These days, I have been reading and playing a lot with R, and I really come to love it…of course, I don’t have a clue on those weird statistics formulas, but it doesn’t mean I can’t use R and try do some awesome stuff with it.

So, yesterday I was thinking about doing another integration between HANA and R, my new adopted kids, so I came with the idea of building a prediction model for a flight company. I followed this steps.

1.- First, I need to choose a table, so I picked SNVOICE:

This table offers us, the carrier id, the date and book id, meaning the amount of tickets sold in a particular day. And from here when can do some calculation and determine how many tickets were sold in each month of a particular year.

2.- I needed a table to store my new information, so I created the table TICKETS_BY_YEAR:

3.- I needed a Procedure script to analyse the table, determine the total amount per day of the month and then gave a grand total per month.

4.- Of course…I needed to call my Procedure…

5.- Once finished, I checked my table to see if everything worked as expected…

6.- After realizing that my data was nice and clean, I exported to an .CSV file (Sorry…no pics this time…I already post it in a previous blog)

7.- I went to my R Studio and start coding…

8.- I watch my generated graphic showing the real tickets sale vs. the predicted tickets sale. The real is for every month of 2011 and the predicted for every month of 2012.

9.- Nothing to do here…it’s done -:)

10.- See you next time with more HANA, R or another nice technology.

### Assigned Tags

You must be Logged on to comment or reply to a post.
is there a way to directly import data into R especially from HANA, also what other visualization we can achieve using R. again thanks for the post
Priya:

The integration between HANA and R is in the making, and it's supposed to be handled by FTP, but I'm not sure about the details. R is an statistics programming language, so you can generate all kind of graphics like Plots, Pies, Histograms, Violins, and so on...you can check them on http://research.stowers-institute.org/efg/R/

Greetings,
Blag.

Hi Alvaro

Now in the above script can you tell me instead of ding a INSERT , is there a way to append to a table type  say out_months and then assign it to a OUT table type parameter ?

Old school ABAP i know but just want to check if there's anything like this available or we always have to assign a table type paramter to a select statement only.

What about fetch cursor , can we use this to append to our table type ??/