attr(base)
attr()所属R语言包:base
Object
Attributes
对象的属性
译者:生物统计家园网
机器人LoveR
描述----------Description----------
Get or set
specific attributes of an object.
获取或设置一个对象的特定属性。
用法----------Usage----------
attr(x, which,
exact = FALSE)
attr(x, which)
参数----------Arguments----------
参数:x
an object whose
attributes are to be accessed.
要访问一个对象,其属性。
参数:which
a non-empty
character string specifying which attribute is to be
accessed.
要访问一个非空的字符串,指定该属性。
参数:exact
logical: should
which be matched exactly?
逻辑:应which完全匹配呢?
参数:value
an object, the
new value of the attribute, or NULL to remove the
attribute.
一个对象,属性,或NULL删除属性的新值。
Details
详情----------Details----------
These functions
provide access to a single attribute of an object. The replacement
form causes the named attribute to take the value specified (or
create a new attribute with the value given).
这些功能提供了一个对象的单个属性的访问。更换的形式,导致采取指定的价值(或创建一个新的属性与给定值)的命名属性。
The extraction
function first looks for an exact match to which amongst the
attributes of x, then (unless exact = TRUE) a unique partial match.
(Setting options(warnPartialMatchAttr=TRUE) causes partial matches
to give warnings.)
提取函数首先查找之间which,然后(除非x)一个独特的部分匹配的属性的精确匹配exact = TRUE
(设定options(warnPartialMatchAttr=TRUE)导致部分匹配,给予警告。)
The replacement
function only uses exact matches.
替换功能只使用精确匹配。
Note that some
attributes (namely class, comment, dim, dimnames, names, row.names
and tsp) are treated specially and have restrictions on the values
which can be set. (Note that
this is not true of levels which should be set for factors via the
levels replacement function.)
请注意,一些属性(即class,comment,dim,dimnames,names,row.names和tsp)被视为特殊和有限制值可以设置。
(请注意,这不是真正的levels应通过levels替换功能的因素。)
The extractor
function allows (and does not match) empty and missing values of
which: the replacement function does not.
提取功能允许(不匹配)空和失踪which值:替换功能不。
Both are
primitive functions.
无论是原始函数。
值----------Value----------
For the
extractor, the value of the attribute matched, or NULL if no exact
match is found and no or more than one partial match is
found.
对于提取属性值相匹配,或NULL如果没有精确匹配发现,一个没有或超过部分匹配被发现。
参考文献----------References----------
The New S
Language. Wadsworth & Brooks/Cole.
参见----------See
Also----------
attributes
attributes
举例----------Examples----------
# create a 2 by 5
matrix[创建2 5的矩阵]
x
1:10
attr(x,"dim")
转载请注明:出自
生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。