1c Objects Attributes
1c Objects Attributes
2/27
Numbers
Numbers in R a generally treated as numeric objects (i.e. double precision real numbers)
If you explicitly want an integer, you need to specify the L suffix
Ex: Entering 1 gives you a numeric object; entering 1L explicitly gives you an integer.
There is also a special number Inf which represents infinity; e.g. 1 / 0; Inf can be used in
ordinary calculations; e.g. 1 / Inf is 0
The value NaN represents an undefined value (not a number); e.g. 0 / 0; NaN can also be
thought of as a missing value (more on that later)
3/27
Attributes
R objects can have attributes
names, dimnames
dimensions (e.g. matrices, arrays)
class
length
other user-defined attributes/metadata
Attributes of an object can be accessed using the attributes() function.
4/27