# Assignment IEP18017, Elena Giasi
store.df <- read.csv(paste("StoreData.csv", sep=""))
View(store.df)
#QUESTION 1
summary(store.df$p2sales)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 51.0 84.0 96.0 100.2 113.0 225.0
#QUESTION 2
attach(store.df)
boxplot(store.df$p2sales,xlab="Product 2 sales", ylab="P2", main="Sales of product 2", horizontal=TRUE)

#QUESTION 3
aggregate(store.df$p2sales, by=list(Promotions=store.df$p2prom), sum)
## Promotions x
## 1 0 169659
## 2 1 38667
#QUESTION 4
store.df$p2prom<-factor(store.df$p2prom,levels=c(0,1),labels=c("NoPromotion","Promotion"))
boxplot(p2sales~p2prom,data=store.df, main="P2 sales with and without promotion", xlab="P2 sales",ylab="P2",horizontal=TRUE)

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