\Header{ts}{Time-Series Objects}
\alias{as.ts}{ts}
\alias{is.ts}{ts}
\alias{print.ts}{ts}
\alias{plot.ts}{ts}
\keyword{ts}{ts}
\begin{Usage}
\begin{verbatim}
ts(data = NA, start = 1, end = numeric(0), frequency = 1,
   deltat = 1, ts.eps = .Options$ts.eps)
as.ts(x)
is.ts(x)

print(ts.obj, calendar, ...)
plot(ts.obj, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{data}] a vector or matrix the observed time-series values.
\item[\texttt{start}] the time of the first observation.
\item[\texttt{end}] the time of the last observation.
\item[\texttt{frequency}] the number of observations per unit of time.
\item[\texttt{deltat}] the fraction of the sampling period between successive
observations; e.g., 1/12 for monthly data.
Only one of \texttt{frequency} or \texttt{deltat} should be provided.
\item[\texttt{ts.eps}] time series comparison tolerance.  Frequencies are
considered equal if their absolute difference is less than
\texttt{ts.eps}.
\end{ldescription}
\end{Arguments}
\begin{Description}
The function \texttt{ts} is used to create time-series objects.  These
are vector or matrices with class of \texttt{"ts"} (and additional
attributes) which represent data which has been sampled at equispaced
points in time.  In the matrix case, each column of the matrix
\texttt{data} is assumed to contain a single (univariate) time series.

The value of argument \texttt{frequency} is used when the series is
sampled an interal number of times in each unit time interval.  For
example, one could use a value of \texttt{7} for \texttt{frequency} when
the data are sampled daily, and the natural time period is a week, or
\texttt{12} when the data are sampled monthly and the natural time
period is a year.

\texttt{start} and \texttt{end} can either be integers which correspond to
natural time units, or vectors of two integers, which give a natural
time unit and a (1-based) number of samples into the time unit.

\texttt{as.ts} and \texttt{is.ts} respectively coerce a vector into a
time-series and test whether an object is a time series.

Time series have methods associated with the generic \texttt{print} and
\texttt{plot} functions.  The argument \texttt{calendar} to the print
method can be used to enable/disable the display of information about
month names, quarter names or year when printing.\end{Description}
\begin{SeeAlso}
\texttt{\Link{frequency}},
\texttt{\Link{start}},
\texttt{\Link{end}},
\texttt{\Link{time}},
\texttt{\Link{window}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
ts(1:10, frequency = 4, start = c(1959, 2)) # 2nd Quarter of 1959
print( ts(1:10, freq = 7, start = c(12, 2)), calendar = TRUE) # print.ts(.)
## Using July 1954 as start date:
gnp <- ts(cumsum(1 + round(rnorm(100), 2)),
          start = c(1954, 7), frequency = 12)
plot(gnp) # using `plot.ts' for time-series plot

## Multivariate
 z <- ts(matrix(rnorm(300),100,3),start=c(1961,1), frequency=12)

ts(1:10, frequency = 4, start = c(1959, 2)) # 2nd Quarter of 1959
print( ts(1:10, freq = 7, start = c(12, 2)), calendar = TRUE) # print.ts(.)
## Using July 1954 as start date:
gnp <- ts(cumsum(1 + round(rnorm(100), 2)),
          start = c(1954, 7), frequency = 12)
plot(gnp) # using `plot.ts' for time-series plot

## Multivariate
 z <- ts(matrix(rnorm(300),100,3),start=c(1961,1), frequency=12)

## A phase plot:
data(nhtemp)
plot(nhtemp, c(nhtemp[-1],NA), cex = .8, col="blue",
	main="Lag plot of New Haven temperatures")

## A phase plot:
data(nhtemp)
plot(nhtemp, c(nhtemp[-1],NA), cex = .8, col="blue",
	main="Lag plot of New Haven temperatures")
\end{ExampleCode}
\end{Examples}

