Read StoreData.CSV

##Read StoreData.CSV; Perform the following tasks

read.csv(file = "Storedata.csv" , header = TRUE)
store.df <- read.csv(paste("StoreData.csv", sep=""))

A.Output the summary statistics (min, max, median etc) of the sales of Product 2 (Pepsi).

summary(store.df$p2sales)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    51.0    84.0    96.0   100.2   113.0   225.0

B.Draw a boxplot of the sales of Product 2 (Pepsi)

attach(store.df)

boxplot(store.df$p2sales,data=store.df,
        main="Box Plot", col='green',
        ylab="sales of Product 2 (Pepsi)" ,
        xlab="Product 2 Pepsi")

C.Draw a table aggregating the sales of Product 2 (Pepsi) in the presence / absence of promotions.

store.df$p2prom.f <- factor(store.df$p2prom, 
                      levels=c(0,1), 
                      labels=c("Absence","Presence"))

aggregate(store.df$p2sales, by= list(Promotion=store.df$p2prom.f),sum)
##   Promotion      x
## 1   Absence 169659
## 2  Presence  38667

D.Draw boxplots showing the sales of Pepsi in presence / absence of promotions.

store.df$p2prom.f <- factor(store.df$p2prom, 
                      levels=c(0,1), 
                      labels=c("Absence","Presence"))

boxplot(store.df$p2sales~store.df$p2prom.f,data=store.df,horizontal = TRUE,
        main="Box Plot", col=c("light pink","light green"),
       ylab="sales of Product 2 (Pepsi)" ,
       xlab="Product 2 Pepsi")

E.Draw the average sales and confidence intervals of Pepsi in the presence / absence of promotions.

library(gplots)
## Warning: package 'gplots' was built under R version 3.4.1
## 
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
## 
##     lowess
plotmeans(store.df$p2sales~store.df$p2prom.f,data=store.df,mean.labels = TRUE)
## 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