Lazy evaluation. See VR's S Programming for a good explanation. But, in
brief, the default values for xlab and ylab are not evaluated until they are
needed. If plot(..., xlab=...) appears after the assignments to x and y,
then x and y are no longer the original argument expressions but numeric
You need evaluate deparse(substitute(x)) _before_ you change x.
so have
xlab; ylab
early in the body of your function.
However, NEWS in R-devel says
o scatter.smooth() and loess.smooth() now handle missing values
in their inputs.
so why reinvent that wheel?
On Thu, 10 Feb