SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Beyond prediction with R & SQL Server


Beyond prediction with R & SQL Server

Author
Message
nick.dale.burns
nick.dale.burns
Mr or Mrs. 500
Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)

Group: General Forum Members
Points: 594 Visits: 272
Comments posted to this topic are about the item Beyond prediction with R & SQL Server
vinh_2001pt
vinh_2001pt
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 303
Nice article. Hope that you will have more in future
Jonathan Mallia
Jonathan Mallia
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1828 Visits: 1297
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.

Thanks.
nick.dale.burns
nick.dale.burns
Mr or Mrs. 500
Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)Mr or Mrs. 500 (594 reputation)

Group: General Forum Members
Points: 594 Visits: 272
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,
Nick
Jonathan Mallia
Jonathan Mallia
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1828 Visits: 1297
Thanks Nick!

I used dcast() and did the trick.

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

Thanks again
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search