add R code for plots