Subsections

12.1 R syntax

A string value must be typed within double quotes, for example, "pointnemotemp.txt". A number is anything made up of digits, plus possibly a decimal point, and scientific notation is also accepted (e.g., 6e2 for 600).

12.1.1 Mathematical operators

R has all of the standard mathematical operators such as addition (+), subtraction (-), division (/), multiplication (*), and exponentation (^). R also has operators for integer division (%/%) and remainder on integer division (%%; also known as modulo arithmetic).

12.1.2 Logical operators

The comparison operators <, >, <=, >=, and == are used to determine whether one value is larger or smaller or equal to another. The result of these operatores is a logical value, TRUE or FALSE.

The logical operators || (or) and && (and) can be used to combine logical values and produce another logical value as the result. These allow complex conditions to be constructed.

12.1.3 Symbols and assignment

Anything not starting with a digit, that is not a special keyword, is treated as a symbol. Values may be assigned to symbols using the <- operator, otherwise any expression involving a symbol will produce the value that has been assigned.

> x <- 1:10

> x

 [1]  1  2  3  4  5  6  7  8  9 10

Paul Murrell

Creative Commons License
This document is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.