added plots and R code