The R Project SVN R

Rev

Rev 59039 | Rev 77633 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42333 ripley 1
% File src/library/base/man/sequence.Rd
2
% Part of the R package, http://www.R-project.org
59039 ripley 3
% Copyright 1995-2007 R Core Team
42333 ripley 4
% Distributed under GPL 2 or later
5
 
2 r 6
\name{sequence}
7
\title{Create A Vector of Sequences}
8
\usage{
9
sequence(nvec)
10
}
56186 murdoch 11
\alias{sequence}
2 r 12
\arguments{
42515 maechler 13
  \item{nvec}{a non-negative integer vector each element of which
14
    specifies the end point of a sequence.}
2 r 15
}
16
\description{
42515 maechler 17
  For each element of \code{nvec} the sequence \code{\link{seq_len}(nvec[i])}
42342 ripley 18
  is created.  These are concatenated and the result returned.
2 r 19
}
42342 ripley 20
\details{
42515 maechler 21
  Earlier versions of \code{sequence} used to work for 0 or negative inputs as
42342 ripley 22
  \code{seq(x) == 1:x}.
42515 maechler 23
 
24
  Note that \code{sequence <- function(nvec) unlist(lapply(nvec, seq_len))}
25
  and it mainly exists in reverence to the very early history of \R.
42342 ripley 26
}
2 r 27
\seealso{
42342 ripley 28
  \code{\link{gl}}, \code{\link{seq}}, \code{\link{rep}}.
2 r 29
}
30
\examples{
61168 ripley 31
sequence(c(3, 2)) # the concatenated sequences 1:3 and 1:2.
2 r 32
#> [1] 1 2 3 1 2
33
}
286 maechler 34
\keyword{manip}