Detrends y
by subtracting a linear trend in x
, to create
a vector that is zero for its first and last finite value.
If the second parameter (y
) is missing, then x
is
taken to be y
, and a new x
is constructed with
seq_along()
. Any NA
values are left as-is.
Value
A list containing Y
, the detrended version of y
, and
the intercept a
and slope b
of the linear function of x
that is subtracted from y
to yield Y
.