StoreData <- read.csv(file="~/Desktop/ACADS/Term 5/DAM/StoreData.csv",head=TRUE,sep=",") # Read the CSV file
summary(StoreData$p2sales) # Summary Statisctics of the sales of Product 2(Pepsi)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 51.0 84.0 96.0 100.2 113.0 225.0
# Box Plot of the sales of Product 2(Pepsi)
boxplot(StoreData$p2sales,main="Sales of Product 2 (Pepsi)", ylab="Sales",xlab="Pepsi",outline=TRUE,col="powder blue")

# sales of Product 2 (Pepsi) in the presence / absence of promotions
#Factor for promotions
StoreData$prom.f <- factor(StoreData$p2prom, levels=c(0,1), labels=c("No Promotions","Promotions"))
#Table aggregating the sales of Product 2 (Pepsi) in the presence / absence of promotions
aggregate(StoreData$p2sales, by=list(Category=StoreData$prom.f), FUN=sum)
## Category x
## 1 No Promotions 169659
## 2 Promotions 38667
#Boxplots showing the sales of Pepsi in presence / absence of promotions
boxplot(p2sales~prom.f,data=StoreData,horizontal = TRUE, col= c("powder blue", "misty rose"), main="Weekly Sales of P2 (Pepsi) with & without promotions", xlab="Sales", ylab="Promotions")

#Average sales and confidence intervals of Pepsi in the presence / absence of promotions
library(gplots)
##
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
##
## lowess
plotmeans(p2sales ~ StoreData$prom.f, data = StoreData,mean.labels = TRUE, frame = FALSE)
## Warning in text.default(x, y, label = labels, col = col, ...): "frame" is
## not a graphical parameter
## Warning in arrows(x, li, x, pmax(y - gap, li), col = barcol, lwd = lwd, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(x, ui, x, pmin(y + gap, ui), col = barcol, lwd = lwd, :
## zero-length arrow is of indeterminate angle and so skipped
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
## graphical parameter
## Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is
## not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
## graphical parameter
