improving analysis (and moving it closer to Practicla Data Science in R chapter 6)