Various functions useful for the analysis of time series in R