basic R code worked out - need to get the R markdown done