R/detrend.R

Defines functions detrend

Documented in detrend

#' detrend
#'
#' @param y
#'
#' @return
#' @export
detrend = function(y) {
  y = as.matrix(y)
  sapply(1:ncol(y), function(i) {
    y_i = y[,i]
    t = 1:length(y_i)
    stats::lm(y_i ~ t)$res
  })
}
pat-alt/SVAA documentation built on Jan. 19, 2024, 7:45 p.m.