adding r code and plots