IMPORTANT BEFORE GETTING STARTED

  1. Set working directory to “Source File Location”

1. Reading local data in R

# reading data and storing into `store.df` dataframe
store.df <- read.csv(paste("StoreData.csv"))
# number of rows and columns
dim(store.df)
## [1] 2080   10

2. Viewing dataframe in R

# attaching data columns of dataframe 'store.df'
attach(store.df)
# viewing dataframe in R
View(store.df)

3. Summary of dataframe store.df

# summary of the dataframe 'store.df'
summary(store.df)
##     storeNum          Year          Week          p1sales   
##  Min.   :101.0   Min.   :1.0   Min.   : 1.00   Min.   : 73  
##  1st Qu.:105.8   1st Qu.:1.0   1st Qu.:13.75   1st Qu.:113  
##  Median :110.5   Median :1.5   Median :26.50   Median :129  
##  Mean   :110.5   Mean   :1.5   Mean   :26.50   Mean   :133  
##  3rd Qu.:115.2   3rd Qu.:2.0   3rd Qu.:39.25   3rd Qu.:150  
##  Max.   :120.0   Max.   :2.0   Max.   :52.00   Max.   :263  
##                                                             
##     p2sales         p1price         p2price         p1prom   
##  Min.   : 51.0   Min.   :2.190   Min.   :2.29   Min.   :0.0  
##  1st Qu.: 84.0   1st Qu.:2.290   1st Qu.:2.49   1st Qu.:0.0  
##  Median : 96.0   Median :2.490   Median :2.59   Median :0.0  
##  Mean   :100.2   Mean   :2.544   Mean   :2.70   Mean   :0.1  
##  3rd Qu.:113.0   3rd Qu.:2.790   3rd Qu.:2.99   3rd Qu.:0.0  
##  Max.   :225.0   Max.   :2.990   Max.   :3.19   Max.   :1.0  
##                                                              
##      p2prom       country 
##  Min.   :0.0000   AU:104  
##  1st Qu.:0.0000   BR:208  
##  Median :0.0000   CN:208  
##  Mean   :0.1385   DE:520  
##  3rd Qu.:0.0000   GB:312  
##  Max.   :1.0000   JP:416  
##                   US:312

4. Descriptive statistics using function describe() from psych package

# make sure you have installed the package 'psych'
library(psych)
describe(store.df)
##          vars    n   mean    sd median trimmed   mad    min    max range
## storeNum    1 2080 110.50  5.77 110.50  110.50  7.41 101.00 120.00  19.0
## Year        2 2080   1.50  0.50   1.50    1.50  0.74   1.00   2.00   1.0
## Week        3 2080  26.50 15.01  26.50   26.50 19.27   1.00  52.00  51.0
## p1sales     4 2080 133.05 28.37 129.00  131.08 26.69  73.00 263.00 190.0
## p2sales     5 2080 100.16 24.42  96.00   98.05 22.24  51.00 225.00 174.0
## p1price     6 2080   2.54  0.29   2.49    2.53  0.44   2.19   2.99   0.8
## p2price     7 2080   2.70  0.33   2.59    2.69  0.44   2.29   3.19   0.9
## p1prom      8 2080   0.10  0.30   0.00    0.00  0.00   0.00   1.00   1.0
## p2prom      9 2080   0.14  0.35   0.00    0.05  0.00   0.00   1.00   1.0
## country*   10 2080   4.55  1.72   4.50    4.62  2.22   1.00   7.00   6.0
##           skew kurtosis   se
## storeNum  0.00    -1.21 0.13
## Year      0.00    -2.00 0.01
## Week      0.00    -1.20 0.33
## p1sales   0.74     0.66 0.62
## p2sales   0.99     1.51 0.54
## p1price   0.28    -1.44 0.01
## p2price   0.32    -1.40 0.01
## p1prom    2.66     5.10 0.01
## p2prom    2.09     2.38 0.01
## country* -0.29    -0.81 0.04