Rev 52927 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/Colon.Rd% Part of the R package, http://www.R-project.org% Copyright 1995-2008 R Core Development Team% Distributed under GPL 2 or later\name{Colon}\title{Colon Operator}\alias{:}\alias{colon}\description{Generate regular sequences.}\usage{from:toa:b}\arguments{\item{from}{starting value of sequence.}\item{to}{(maximal) end value of the sequence.}\item{a, b}{\code{\link{factor}}s of the same length.}}\details{The binary operator \code{:} has two meanings: for factors \code{a:b} isequivalent to \code{\link{interaction}(a, b)} (but the levels areordered and labelled differently).For other arguments \code{from:to} is equivalent to \code{seq(from, to)},and generates a sequence from \code{from} to \code{to} in steps of \code{1}or \code{-1}. Value \code{to} will be included if it differs from\code{from} by an integer up to a numeric fuzz of about \code{1e-7}.Non-numeric arguments are coerced internally (hence withoutdispatching methods) to numeric---complex values will have theirimaginary parts discarded with a warning.}\value{For numeric arguments, a numeric vector. This will be of type\code{\link{integer}} if \code{from} is integer-valued and the resultis representable in the \R integer type, otherwise of type\code{"double"} (aka \code{\link{mode}} \code{"\link{numeric}"}).For factors, an unordered factor with levels labelled as \code{la:lb}and ordered lexicographically (that is, \code{lb} varies fastest).}\references{Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)\emph{The New S Language}.Wadsworth & Brooks/Cole.\cr(for numeric arguments: S does not have \code{:} for factors.)}\seealso{\code{\link{seq}} (a \emph{generalization} of \code{from:to}).As an alternative to using \code{:} for factors, \code{\link{interaction}}.For \code{:} used in the formal representation of an interaction, see\code{\link{formula}}.}\examples{1:4pi:6 # real6:pi # integerf1 <- gl(2,3); f1f2 <- gl(3,2); f2f1:f2 # a factor, the "cross" f1 x f2}\keyword{manip}