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

x <- c(1, 5, 9)
names(x) <- c('a', 'b', 'c')
x

names(x) <- NULL
x

y <- c(a=1, b=5, c=9)
y

typeof(x)
class(x)
mode(x)
length(y)
attributes(y)

str(x)