Constructing a waterfall plot in R