#' Detrend
#' Detrend time series
#' @param x vector time series
#' @param time vector of time steps
#'
#' @return detrended x
#' @export
detrend <- function(x, time=1:length(x)){
stats::residuals(stats::lm(x~time))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.