Assignment 1
store.df <- read.csv(paste("StoreData.csv", sep=""))
summary(store.df$p2sales)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 51.0 84.0 96.0 100.2 113.0 225.0
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"))
aggregate(store.df$p2sales, by=list(promotion=store.df$p2prom.f), sum)
## promotion x
## 1 No 169659
## 2 Yes 38667
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)
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