script to plot smoothed data in R