The R Project SVN R

Rev

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

Rev Author Line No. Line
18286 ripley 1
\name{Syntax}
2
\alias{Syntax}
3
\title{Operator Syntax}
4
\description{
5
  Outlines \R syntax and gives the precedence of operators
6
}
7
\details{
8
  The following unary and binary operators are defined.  They are listed
9
  in precedence groups, from highest to lowest.
10
  \tabular{ll}{
11
    \code{[ [[}\tab indexing\cr
19503 luke 12
    \code{::}\tab name space/variable name separator\cr
21048 ripley 13
    \code{$ @}\tab component / slot extraction\cr
18286 ripley 14
    \code{^}\tab exponentiation (right to left)\cr
15
    \code{- +}\tab unary minus and plus\cr
16
    \code{:}\tab sequence operator\cr
17
    \code{\%any\%}\tab special operators\cr
18
    \code{* /}\tab multiply, divide\cr
18347 ripley 19
    \code{+ -}\tab (binary) add, subtract\cr
18286 ripley 20
    \code{< > <= >= == !=}\tab ordering and comparison\cr
21
    \code{!}\tab negation\cr
22
    \code{&  &&}\tab and\cr
23
    \code{| ||}\tab or\cr
24
    \code{~}\tab as in formulae\cr
25
    \code{-> ->>}\tab rightwards assignment\cr
26
    \code{=}\tab assignment (right to left)\cr
21816 ripley 27
    \code{<- <<-}\tab assignment (right to left)\cr
18286 ripley 28
    \code{?}\tab help (unary and binary)\cr
29
  }
30
  Within an expression operators of equal precedence are evaluated
31
  from left to right except where indicated.
32
 
33
  The links in the \bold{See Also} section covers most other aspects of
34
  the basic syntax.
35
}
36
\note{
37
  There are substantial precedence differences between \R and S.  In
38
  particular, in S \code{?} has the same precedence as \code{+ -} and
39
  \code{& && | ||} have equal precedence.
40
}
24300 ripley 41
\references{
42
  Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
43
  \emph{The New S Language}.
44
  Wadsworth \& Brooks/Cole.
45
}
18286 ripley 46
\seealso{
47
  \code{\link{Arithmetic}}, \code{\link{Comparison}}, \code{\link{Control}},
48
  \code{\link{Extract}}, \code{\link{Logic}}, \code{\link{Paren}}
49
 
50
  The \emph{R Language Definition} manual.
51
}
52
\keyword{documentation}