Assignment 1

Submitted by Apurva_PGP32242

Read the data using read.csv

store.df <- read.csv(paste("StoreData.csv", sep=""))

A. Summary statistics of Sales of Product 2

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. Box Plot of Sales of product 2

attach(store.df)
boxplot(p2sales,data=store.df,
        main="Box Plot", 
        ylab="Sales",
        xlab="Product 2 (Pepsi)")

## Create a factor for promotion

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

C. Total Sales of Product 2, by Country

aggregate(store.df$p2sales, by=list(promotion=store.df$p2prom.f), sum)
##   promotion      x
## 1        No 169659
## 2       Yes  38667

D. Box Plots showing the sales of Pepsi in presence / absence of promotions

boxplot(p2sales~p2prom.f, data=store.df,
        main="Weekly Sales of P2 with and without promotions", 
        xlab="Weekly Sales", 
        ylab="p2 promoted in Store?", horizontal=TRUE)

E. 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(store.df$p2sales~store.df$p2prom.f, data=store.df, mean.labels=TRUE, connect = FALSE, 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