R scripts to complete third R class assignment