attributes
All Attributes of an Object
Description
Returns or changes all of the attributes of an object. Attributes specify
the characteristics of any data object.
Usage
attributes(obj)
attributes(obj) <- value
Arguments
obj |
any object.
|
value |
a list object.
|
Details
To explicitly delete all attributes of x, use attributes(x) <- NULL.
When you make an assignment, remember that some attributes accept only certain valid values. See attr
for more information.
Value
attributes(x) | returns a list of all the attributes of x. |
attributes(x) <- value | returns value. |
Side Effects
The attributes of x, and generally the class, are changed as a result
of the assignment
version of this function.
The attributes of x are set to the corresponding components of
value and old attributes of x are deleted.
In some cases attributes are mutually exclusive; for example,
assigning names (a
"names" attribute) to a matrix or array
currently erases
"dim" and
"dimnames"
attributes and changes the matrix
or array to a vector.
If value has length 0, all attributes are deleted.
See Also
Examples
m <- lm(y ~ x, data.frame(y=1:4, x=4:1))
attributes(m) # attributes of a linear model
foo <- 1:8
attributes(foo) <- list(dim = c(2,4)) # coerces foo to a matrix
attributes(foo) <- NULL # removes all attributes from foo