R/rolling_slope.R
slope.Rd
Computes the linear regression slope for a numeric response variable y.
y
slope(y, x = seq_along(y))
A numeric vector of the response variable.
A numeric vector of the predictor variable, defaults to using the index of x = seq_along(y).
x = seq_along(y)
A numeric slope value of y/x.
y/x
Uses the least squares formula on complete case analysis. A single valid observation will return NA.
NA
if (FALSE) { # \dontrun{ y <- c(1, 3, 2, 5, 8, 7, 9, 12, 11, 15, 14, 17, 18) slope(y) y <- c(1, 3, NA, 5, 8, 7, 9, 12, NA, NA, NA, 17, NA) slope(y) } # }