Beyond prediction with R & SQL Server

  • Comments posted to this topic are about the item Beyond prediction with R & SQL Server

  • Nice article. Hope that you will have more in future

  • Hi,

    Many thanks for the article. It is always nice to see R applied in action.

    Can you please let us know the definition of byRegion data frame?

    I am not sure the definition/structure required by the heat map so knowing the details will help alot.


  • Hi Jonathan,

    Thanks for your question. The byRegion dataframe has 12 individual rows (one for each region / product pairing) with 36 columns (one column of sales info for every month). You can think of it as the time series graphs stacked one on top of the other.

    Getting from row-based storage (i.e. a relational database) to the dataframe is a necessary step for a lot of statistical analyses or machine learning. You could do it in many many ways (for example a pivot table in SQL, or using something like dcast() or lapply() in R).

    Hope that helps,


  • Thanks Nick!

    I used dcast() and did the trick.

    Many thanks, if you have other similar articles, keep them coming 🙂

    Thanks again

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply