Introduction of R Objects
The entities R operates on are technically known as objects. Examples are vectors of numeric
(real) or complex values, vectors of logical values and vectors of character strings. These are
known as “atomic” structures since their components are all of the same type, or mode, namely
numeric, complex, logical, character and raw.
command to determine what an
Mode of Objects
Vectors must have their values all of the same mode. Thus any given vector must be
unambiguously either logical, numeric, complex, character or raw.
is the default value type for most numbers. An integer is a subset of the
numeric class, and may be used as a numeric value. You can perform any type of math or
logical operation on numeric values, including:
> log(3 * 4 * (2 + pi))
# Note that pi is a built-in constant,
# and log() the natural log function.
> 2 > 3
# Basic logical operations, including >,
# <, >= (greater than or equals),
# <= (less than or equals), == (exactly
# equals), and != (not equals).
> 3 >= 2 && 100 == 1000/10 # Advanced logical operations, including
# & (and), && (if and only if), | (or),
# and || (either or).
(missing value), and
number) are special numeric values on which most math operations will fail. (Logical
operations will work, however.)