I am trying to use ggplot2 to produce different visualization along with the regression model in it. This is not a HOMEWORK assignment!
I have a data science project that I need to produce. I have a dataset of three main products distributed over 7 regions. I want to create a plot by using ggplot2 that outputs 7 little screens in which have regression models in them. Please ask me for more clarification since this is my first time using ggplot2.
Here is my code:
 data1 %>% 
 mutate(PRODUCT_SUB_LINE_DESCR=as.character(PRODUCT_SUB_LINE_DESCR)) %>% 
 group_by(ACCTG_YEAR_KEY, PRODUCT_SUB_LINE_DESCR, CUST_REGION_DESCR) %>% 
 summarise(Sales= sum(Sales)) %>% 
 ggplot() + geom_smooth(aes(x=PRODUCT_SUB_LINE_DESCR,y=Sales,
   color=PRODUCT_SUB_LINE_DESCR), method = "lm",show.legend = F) + 
 facet_wrap(~CUST_REGION_DESCR) 

