Chapter 12 Summary diagnostics in R

Finally, the inbuilt functions “head” and “summary” in R are useful starting points for investigating a variable of interest. Below, I’ve illustrated this with the biscuit dataset.

12.0.1 Taking a “snapshot” of the dataset

That is, subsetting only the data before the policy.

head(before)
##   Avg.choc.chips                      timeframe
## 1       7.479294 2017 - before no eating policy
## 2       9.480802 2017 - before no eating policy
## 3      12.694557 2017 - before no eating policy
## 4      10.569705 2017 - before no eating policy
## 5      10.508374 2017 - before no eating policy
## 6       7.865125 2017 - before no eating policy

12.0.2 Summarizing the data

-subsetting only the data before the policy.

summary(before)
##  Avg.choc.chips                            timeframe  
##  Min.   : 3.500   2017 - before no eating policy:300  
##  1st Qu.: 8.738   2018 - after no eating policy :  0  
##  Median :10.050                                       
##  Mean   :10.174                                       
##  3rd Qu.:11.773                                       
##  Max.   :16.082