讀取資料
pacman::p_load("sas7bdat")
dta <- read.sas7bdat("C:/Users/PARENTCARECHILDREN/Desktop/2020-04-13-Homework-3-Trellis/sales.sas7bdat")
dta$region <- as.factor(dta$region)
dta$quarter <- as.factor(dta$quarter)
dta$income <- dta$sales - dta$expense #收入
head(dta)## product category customer year month quarter market sales expense region
## 1 Shoes Shoes Acme 2001 1 1 1 300 240 1
## 2 Boots Shoes Acme 2001 1 1 1 2200 1540 1
## 3 Slippers Slippers Acme 2001 1 1 1 900 540 1
## 4 Shoes Shoes Acme 2001 2 1 1 100 80 1
## 5 Boots Shoes Acme 2001 2 1 1 1400 980 1
## 6 Slippers Slippers Acme 2001 2 1 1 0 0 1
## district return constantv quantity income
## 1 1 0 1 30 60
## 2 1 0 1 275 660
## 3 1 0 1 180 360
## 4 1 0 1 10 20
## 5 1 0 1 175 420
## 6 1 0 1 0 0
Eastern地區並沒有銷售量
總銷售量隨著「季」升高
三種產品銷售量都隨著季節升高,Slippers>Boots>Shoes
dta$quantity <- round((dta$quantity/100),0)
dotplot(quantity ~ month, groups=product, data=dta, xlab="Month", ylab="Quantity(per hundred)", type=c('p', 'g',"r"), auto.key=list(space="top", columns=3))三種產品收入都隨著月份升高,Slippers>Boots>Shoes
dta$income <- round((dta$income/100),0)
dotplot(income ~ month, groups=product, data=dta, xlab="Month", ylab="Income(per hundred)", type=c('p', 'g',"r"), auto.key=list(space="top", columns=3))2001年和2002年的營收,都是隨著月份而上升
## Warning in draw.key(simpleKey(...), draw = FALSE): not enough rows for columns
顧客群大部分來自Nothern地區
不同地區,有不同的廠商購買
## Warning in draw.key(simpleKey(...), draw = FALSE): not enough rows for columns
由以上可知,收入隨著月份而升高,其中賣最好的是Slippers(拖鞋)。目前Eastern地區的市場尚未開發,其他地區都已有市場,只是市場主要在Nothern地區,該地區主要的顧客是Acme。至於其他地區,Southern地區的顧客是TwoFeet、Western地區的顧客是BigX,但兩者的購入量遠比Acme還要少。
因此1. 開發Eastern地區的市場。 2. 提高Southern地區、Western地區,或是TwoFeet、BigX的購入量。3. 了解銷售量隨著月份而升高的原因,開發淡季市場。4. 維持拖鞋的高銷售,同時提升靴子(Boots)、步鞋(Shoes)的銷售。5. 維持Acme的市場。