Section 19 Class Attribute
19.1 Attribute
- Attribute of an object
- metadata or special information for the object
- use function
attributes()
- Example:
attributes(x)
- absence of attribute returns
NULL
- type of object may not change, but attribute may change
19.2 Examples: Attribute
<- c(1, 5, 9)
x names(x) <- c('a', 'b', 'c')
x
names(x) <- NULL
x
<- c(a=1, b=5, c=9)
y
y
typeof(x)
class(x)
mode(x)
length(y)
attributes(y)
str(x)