add R code and figures