R - (Object|Variable|Symbol)
Table of Contents
1 - About
R provides a number of specialized objects. They are created (instantiated), used and referenced through variable (known as symbol).
- When you read the term object in the documentation, you can interchange it with the term variable (known as symbol)
- The variable (known as symbol) are themselves objects
The variable (symbol) references objects.
The symbols are themselves objects and has wide ranging effects.
R have some reserved variable (system variable)
2 - Articles Related
3 - Example
> x=1 # Implicit printing of the variable > x  1 # Explicit printing of the variable > print(x)
The  indicates that x is of the vector class
> x+x  2
4 - Attribute
All objects except the NULL object can have one or more attributes.
Common R objects attributes are:
- the element names,
- dim(ension) attribute (e.g. matrices, arrays)
- dimnames: the size and the name of each dimension of the object
- class which stores the name of the class of the object
- user-defined attributes
Attributes of an object can be listed using the attributes() function.
# data.frame object x=data.frame(a=1:4,b=1:4,c=1:4) attributes(x)
$names  "a" "b" "c" $row.names  1 2 3 4 $class  "data.frame"
The value of a specific attribute can be obtained using the attr() function (or NULL if the attribute is not defined).
# data.frame object x=data.frame(a=1:4,b=1:4,c=1:4) attr(x, "class")
5 - Class
R supports several class (data structure) for an object:
- …. See class
6 - Type
7 - Management
7.1 - Rename
newname <- oldname rm(oldname)
7.2 - List
List current objects (objects in the workspace)
ls shows you the variables
> x <- rnorm(50) > y <- rnorm(x) > ls()
 "x" "y"
7.3 - Delete
> rm(x, y) > ls()
7.4 - Copy
newobject <- edit(object)
7.5 - Diff
7.6 - Serialization
7.7 - Search
apropos (or find) returns a character vector of all objects matching the text searched.