R Functions for Time Series Analysis