\Header{seq}{Sequence Generation}
\alias{:}{seq}
\methalias{seq.default}{seq}
\keyword{manip}{seq}
\begin{Description}\relax
Generate regular sequences.\end{Description}
\begin{Usage}
\begin{verbatim}
from:to
seq(from, to)
seq(from, to, by=)
seq(from, to, length=)
seq(along)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{from}] starting value of sequence.
\item[\code{to}] (maximal) end value of the sequence.
\item[\code{by}] increment of the sequence.
\item[\code{length}] desired length of the sequence.
\item[\code{along}] take the length from the length of this argument.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The operator \code{:} and the first \code{seq(.)} form generate the
sequence \code{from, from+1}, \ldots, \code{to}.
\code{seq} is a generic function.

The second form generates \code{from, from+by}, \ldots, \code{to}.

The third generates a sequence of \code{length} equally spaced values
from \code{from} to \code{to}.

The last generates the sequence \code{1, 2}, \ldots,
\code{length(along)}.

If \code{from} and \code{to} are factors of the same length, then
\code{from : to} returns the ``cross'' of the two.\end{Details}
\begin{Value}
The result is of \code{mode} \code{"integer"} if \code{from} is
(numerically equal to an) integer and \code{by} is not specified.\end{Value}
\begin{SeeAlso}\relax
\code{\Link{rep}},
\code{\Link{sequence}},
\code{\Link{row}},
\code{\Link{col}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
1:4
pi:6 # float
6:pi # integer

seq(0,1, length=11)
str(seq(rnorm(20)))
seq(1,9, by = 2) # match
seq(1,9, by = pi)# stay below
seq(1,6, by = 3)
seq(1.575, 5.125, by=0.05)
stopifnot(
 3 == seq(3,3,  by=pi),
 3 == seq(3,3.1,by=pi),
 seq(1,6,by=3) == c(1,4),
 seq(10,4.05,by=-3) == c(10,7)
)

for (x in list(NULL, letters[1:6], list(1,pi)))
  cat("x=",deparse(x),";  seq(along = x):",seq(along = x),"\n")

f1 <- gl(2,3); f1
f2 <- gl(3,2); f2
f1:f2 # a factor, the ``cross''  f1 x f2
\end{ExampleCode}
\end{Examples}

