Created r code for plots and corresponding output.