R script for quiz week 2