Appendix B

Time series data

There are several possibilities for dealing with time series data in inline. In this appendix a concise account is provided of the date–time classes and the available implementations for creating and handling time series data objects. This is based on Ripley and Hornik (2001), Grothendieck and Petzoldt (2004), Zeileis and Grothendieck (2005), Würtz et al. (2009) and Chalabi et al. (2011). In the next section the classes and methods for handling dates and times are presented. In the rest of this appendix the various possibilities of creating a time series object and its manipulations are discussed.

B.1 Date-time classes

Classes and methods for defining and manipulating dates and times are provided in the base inline distribution as well as in contributed packages. In the following the classes and methods are presented with increasing degree of complexity.

The class Date was introduced to base inline in version R-1.9.0. This class supports only dates without a time stamp. Internally, dates are represented as the day count since 1 January 1970. The printing of these objects can be adjusted according to the percentage abbreviations listed in ?strptime with the format() method ...

Get Financial Risk Modelling and Portfolio Optimization with R now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.