
i
i
“K23166” — 2015/1/28 — 9:35 — page 221 — #247
i
i
i
i
i
i
A.4. FUNDAMENTAL STRUCTURES AND OBJECTS 221
A.4.1 Objects and vectors
Almost everything in R is an object, which may be initially disconcerting to a new user.
An object is simply something on which R can operate. Common objects include vectors,
matrices, arrays, factors (see 2.2.19), dataframes (akin to datasets in other systems), lists,
and functions.
The basic variable structure is a vector. Vectors can be created using the <- or =
assignment operators (which assigns the evaluated expression on the right-hand side of the
operator to the object name on the left-hand side).
> x <- c(5, 7, 9, 13,