added in plots and R code