add R codes and plots