added echo for r code and formatting trick for plots