R plots and code