New R algorithms for WPS.

One line cleanup from an R file as well.