Updated rmd file to include my code and explanation.