Final plots and R code