这些函数访问对象的属性下面的第一个表单返回对象的属性名单。名单替换表单使用赋值右侧的列表作为对象的属性(如果合适)。
attributes(x)
attributes(x) mostattributes(x)
x : 任何R对象
value : 一个适当的属性命名列表,orNULL。
x < - cbind(a = 1:3, pi = pi) # simple matrix with dimnames
attributes(x)
## strip an object's attributes:
attributes(x) < - NULL
x # now just a vector of length 6
mostattributes(x) < - list(mycomment = "really special", dim = 3:2,
dimnames = list(LETTERS[1:3], letters[1:5]), names = paste(1:6))
x # dim(), but not {dim}names