R programming coursework 3 code