Adding R source code and figures