There is a plethora of packages that work with time series and it can be difficult to determine which package might be best for a given situation. I have decided to take a historical approach to learning about the various packages, in order of ts, zoo, and xts. The base ts, can only handle strictly regular time series and cannot accept date vectors of more than 2 characters. Hence, the zoo package was developed to handle regular and irregular time series and different date formats. The xts package is an extension of zoo and works with a variety of date formats and conveniently stores the time series in matrix form. An introduction to time series plots will provide the reader with some qualities to investigate in a time series graph. Decomposition will be discussed but the method will not be shown. Skills with each package will be shown, including plots, subsetting and aggregation of data.

Time Series Introduction

A time series is a series of data points in chronological order, where time is the independent variable. In a strictly regular time series, the chronological data points will be evenly spaced. A regular time series could be unevenly spaced but possess some type of underlying regularity. An irregular time series will be too unequally spaced to determine any type of regularity. These individual definitions seem to vary, but this seems to be what the zoo package in R is using.

A time series is seasonal if a strict cyclical pattern occurs over a constant time interval. The frequency of a time series indicates the number of observations during that a time period. Stocks, climate, and production data are examples that lend itself well to time series analysis, because they are often sampled regularly. Some sample time series plots are shown below. Three of the graphs are plots of the monthly recreational visitors to a certain National Park. The US Air Passengers is in the datasets package, and the sheep plot is in the fma package. The humidity graph contains 1-4 samples per hour of humidity data for Minneapolis, MN from January to March 2017.