1 Flipped Assignment 5

dat<-readRDS("/Users/cjcurry/Downloads/FairTraders_Receipts_and_StorageBins.rds")
str(dat)
## 'data.frame':    6275201 obs. of  15 variables:
##  $ ItemNo     : num  1101010 1101010 1101010 1101010 1101010 ...
##  $ Date.x     : POSIXct, format: "2011-01-12" "2011-01-12" ...
##  $ SourceType : chr  "Supplier Order" "Supplier Order" "Supplier Order" "Supplier Order" ...
##  $ SourceNo   : chr  "236169" "236169" "236169" "236169" ...
##  $ Quantity.x : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ MerchVol.x : num  1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 1.2 ...
##  $ CustGroup  : chr  "FESTIVAL" "FESTIVAL" "FESTIVAL" "FESTIVAL" ...
##  $ Date.y     : POSIXct, format: "2010-05-01" "2010-12-01" ...
##  $ BinCode    : chr  "3B16A2" "1H36E1" "1Z03B1" "1G21D1" ...
##  $ BinSize    : chr  "CHICKENBOX" "PALLET" "PALLET" "PALLET" ...
##  $ BinVol     : num  2.29 60 60 60 60 ...
##  $ Quantity.y : num  37 804 700 339 278 550 804 3 800 30 ...
##  $ ItemBoxType: chr  "Skid" "Skid" "Skid" "Skid" ...
##  $ MerchVol.y : num  44.4 964.8 840 406.8 333.6 ...
##  $ PercentFull: num  19.37 16.08 14 6.78 5.56 ...

1.1 1. How many entries are in the data file?

There are entries in the data file.

nrow(dat)
## [1] 6275201

1.2 2. What percentage of product was received by each business unit?

the percentage of product by each group

dat$CustGroup<-as.factor(dat$CustGroup)
str(dat$CustGroup)
##  Factor w/ 3 levels "ECOMMERCE","FESTIVAL",..: 2 2 2 2 2 2 2 2 2 2 ...
table(dat$CustGroup)
## 
## ECOMMERCE  FESTIVAL WHOLESALE 
##    961299   5163906    149996
prop.table(table(dat$CustGroup))
## 
##  ECOMMERCE   FESTIVAL  WHOLESALE 
## 0.15319015 0.82290687 0.02390298

1.3 3. What percentage of orders were Purchase Orders?

The percentage of orders that were Purchase Orders

dat$SourceType<-as.factor(dat$SourceType)

table(dat$SourceType)
## 
## Purchase Order Supplier Order 
##         961299        5313902
prop.table(table(dat$SourceType))
## 
## Purchase Order Supplier Order 
##      0.1531902      0.8468098

1.4 4. What percentage of orders were received by the eCommerce business unit through a Purchase Order?

The percantage of orders that were recieved by the eCommerce business unit

prop.table(table(dat$CustGroup, dat$SourceType))
##            
##             Purchase Order Supplier Order
##   ECOMMERCE     0.15319015     0.00000000
##   FESTIVAL      0.00000000     0.82290687
##   WHOLESALE     0.00000000     0.02390298

The percentage of orders that were recieved by the eCommerce is 15%.

1.5 5. What percentage of orders were received by the Wholesale business unit through a Purchase Order?

The percantage of order recieved by the Wholesale business unit

prop.table(table(dat$CustGroup, dat$SourceType))
##            
##             Purchase Order Supplier Order
##   ECOMMERCE     0.15319015     0.00000000
##   FESTIVAL      0.00000000     0.82290687
##   WHOLESALE     0.00000000     0.02390298

The percentage of orders that were recieved by the Wholesale business unit is 0.

1.6 6. What percentage of orders were stored as a Pallet?

table(dat$BinSize)
## 
##     BASKET CHICKENBOX HALFPALLET  ODDSIZE3A     PALLET TALLPALLET 
##      12752    2911658     158661       3644    3119723      68763
prop.table(table(dat$BinSize))
## 
##       BASKET   CHICKENBOX   HALFPALLET    ODDSIZE3A       PALLET   TALLPALLET 
## 0.0020321261 0.4639943804 0.0252838116 0.0005806985 0.4971510873 0.0109578960

The percantage of orders stored as a pallet is 49.7%

1.7 7. What percentage of orders were received as a Purchase Order and stored in a Chicken Box?

prop.table(table(dat$BinSize, dat$SourceType))
##             
##              Purchase Order Supplier Order
##   BASKET       0.0002200726   0.0018120535
##   CHICKENBOX   0.0717017670   0.3922926134
##   HALFPALLET   0.0018459966   0.0234378150
##   ODDSIZE3A    0.0001958503   0.0003848482
##   PALLET       0.0754847534   0.4216663339
##   TALLPALLET   0.0037417128   0.0072161832

The percentage of orders that were recieved as a Purchase Order and stored in a Chicken Box is 7.1%

1.8 8. What percentage of orders were received as a Purchase Order or stored in a Chicken Box?

We added the percentage of Purchase orders and the percentage of orders stored in a Chicken Box and subtracted the percentage of orders that were purchase orders and stored in a chicken box. 15.32% + 46.4% - 7.17% = 54.55%