0627
  7   	坙栞m_J	򳅯2燵��阞芽慆^瘸r饵dn0K#@��別惥缙拍 ?�     	%\VignetteIndexEntry{xts: Extensible Time Series}
\documentclass{article}
\usepackage{hyperref}
\hypersetup{colorlinks,%
            citecolor=black,%
            linkcolor=blue,%
            urlcolor=blue,%
            }

\title{\bf xts: Extensible Time Series }
\author{Jeffrey A. Ryan \and Joshua M. Ulrich}
\date{May 18, 2008}

\begin{document}

\maketitle
\tableofcontents

\section{Introduction}
The statistical language {\tt R}~\cite{R}
 offers the time-series analyst a variety of mechanisms
to both store and manage time-indexed data.  
Native {\tt R} classes potentially suitable
for time-series data include {\tt data.frame}, {\tt matrix}, {\tt vector}, and
{\tt ts} objects. Additional time-series tools have been subsequently introduced 
in contributed packages to
handle some of the domain-specific shortcomings of the native {\tt R} classes.
These include {\tt irts} from the {\tt tseries} package\cite{tseries},
{\tt timeSeries} from the {\tt Rmetrics} bundle\cite{rmetrics}, and
{\tt zoo}~\cite{zoo} from their 
respective packages. Each of these contributed classes provides unique solution
to many of the issues
related to working with time-series in R.

While it seems a bit paradoxical with all the current options
available, what {\tt R} really needed was one more
time-series class.  Why? Users of R have had many choices over the
years for managing time-series data. This variety has meant that
developers have had to pick and choose the classes they would support,
or impose the necessary conversions upon the end-user. With the sheer
magnitude of software packages available from CRAN, it has become a challenge
for users and developers 
to select a time-series class that will manage the needs of the
individual user, as well as remain compatible with the broadest audience.

What may be sufficient for one use --- say a quick correlation matrix may be
too limiting when more information needs to be incorporated 
in a complex calculation.
This is especially true for functions that rely on time-based indexes to
be manipulated or checked.

The previous solution to managing different data needs often
involved a series of {\tt as} calls,
to coerce objects from one type to another.  While this may
be sufficient for many cases, it is less flexible than allowing the users
to simply use the object they are accustomed to, or quite possibly require.
Additionally, all current coercion methods fail to maintain the original
object's data in its entirety.  Converting from a {\tt timeSeries} class to
{\tt zoo} would cause attributes such as 
{\em FinCenter}, {\em format}, and {\em recordIDs} to be lost.
Converting back to a {\tt timeSeries} would then add new
values different than the original.
For many calculations that do not modify the data, this is most likely
an acceptable side effect.  For functions that convert data ---
such as {\tt xts}'s {\tt to.period} --- it limits the value of the function,
as the returned object is missing
much of what may have been a factor in the original class consideration.

One of the most important additions the new {\tt xts} class makes
to the R user's
workflow doesn't use {\tt xts} at all, at least not explicitly.
By converting data to {\tt xts} inside a function, the function developer
is guaranteed to have to only manage a single class of objects. 
It becomes unecessary to write specific methods to handle different data.
While many functions do have
methods to accommodate different classes, most do not. Before {\tt xts}, the
{\tt chartSeries} function in the {\tt quantmod} package\cite{quantmod}
was only able to handle {\tt zoo} objects well.
Work had been done to allow for {\tt timeSeries} objects to be used as well, but
many issues were still being worked out.
With {\tt xts} now used internally, it is
possible to use \emph{any} of R's time-series classes.
Simultaneously saving development time and
reducing the learning/using curve for the end user.  The function now
simply handles whatever time-series object it receives
exa