R语言base包 attributes函数使用说明

返回R语言base包函数列表


功能\作用概述:

这些函数访问对象的属性下面的第一个表单返回对象的属性名单。名单替换表单使用赋值右侧的列表作为对象的属性(如果合适)。


语法\用法:

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