detrend_ts | R Documentation |
Removes directional signals from time series using loess, linear regression or gaussian detrending.
detrend_ts(data, method = "linear", bandwidth = NULL, span = 0.25, degree = 2)
data |
The dataframe to be detrended. The first column must be a vector of dates with all other columns the individual time series. |
method |
The method of detrending. Options include |
bandwidth |
If |
span |
If |
degree |
If |
Dataframe of deseasoned time series.
#Generate five random monthly time series
#of 5 years length.
spp_data <- matrix(nrow = 5*12, ncol = 5)
spp_data <- sapply(1:dim(spp_data)[2], function(x){
spp_data[,x] <- rnorm(5*12,mean=20,sd=5)})
multi_spp_data <- cbind("time" =
seq(as.Date('2000/01/01'), as.Date('2004/12/01'), by="month"),
as.data.frame(spp_data))
detrend_dat <- detrend_ts(data = multi_spp_data,
method = "gaussian",
bandwidth = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.