dimnames(base)
dimnames()所属R语言包:base
Dimnames of an Object
dimnames的对象
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Retrieve or set the dimnames of an object.
检索或设置对象dimnames。
用法----------Usage----------
dimnames(x)
dimnames(x) <- value
参数----------Arguments----------
参数:x
an R object, for example a matrix, array or data frame.
R对象,例如一个矩阵,数组或数据框。
参数:value
a possible value for dimnames(x): see the "Value" section.
看到“价值”一节:dimnames(x)可能值。
Details
详情----------Details----------
The functions dimnames and dimnames<- are generic.
职能dimnames和dimnames<-是通用的。
For an array (and hence in particular, for a matrix), they retrieve or set the dimnames attribute (see attributes) of the object. A list value can have names, and these will be used to label the dimensions of the array where appropriate.
对于array(因此,特别是对一个matrix),他们检索或设置dimnames属性的对象(属性)。可以有一个列表value名称,而这些将被用来标记阵列在适当的尺寸。
The replacement method for arrays/matrices coerces vector and factor elements of value to character, but does not dispatch methods for as.character. It coerces zero-length elements to NULL, and a zero-length list to NULL. If value is a list shorter than the number of dimensions, it is extended with NULLs to the needed length.
阵列/矩阵胁迫向量和因子value字符,但元素的替代方法不派遣as.character方法。它胁迫零长度元素NULL,长度为零的列表NULL。如果value比维数较短是一个列表,它是NULL的延长到需要的长度。
Both have methods for data frames. The dimnames of a data frame are its row.names and its names. For the replacement method each component of value will be coerced by as.character.
这两个数据框的方法。数据框dimnames的是其row.names和names。 value的每个组件的更换方法将被迫as.character。
For a 1D matrix the names are the same thing as the (only) component of the dimnames.
对于一维矩阵:names(只)组成的dimnames同样的事情。
Both are primitive functions.
无论是原始函数。
值----------Value----------
The dimnames of a matrix or array can be NULL or a list of the same length as dim(x). If a list, its components are either NULL or a character vector with positive length of the appropriate dimension of x. The list can be named.
矩阵或数组dimnames可以NULL或相同的长度为dim(x)名单。如果一个列表,其成分是要么NULL或积极长度适当的维x的特征向量。该列表可以被命名。
For the "data.frame" method both dimnames are character vectors, and the rownames must contain no duplicates nor missing values.
为"data.frame"方法两个dimnames是特征向量,的rownames必须包含不重复,也不遗漏值。
注意----------Note----------
Setting components of the dimnames, e.g. dimnames(A)[[1]] <- value is a common paradigm, but note that it will not work if the value assigned is NULL. Use rownames instead, or (as it does) manipulate the whole dimnames list.
的dimnames,例如设置组件dimnames(A)[[1]] <- value是一种常见的范例,但请注意,它不会工作,如果分配的值是NULL。使用rownames代替,或者(因为它)操纵整个列表dimnames。
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
参见----------See Also----------
rownames, colnames; array, matrix, data.frame.
rownames,colnames;array,matrix,data.frame。
举例----------Examples----------
## simple versions of rownames and colnames[简单#rownames和colnames的版本]
## could be defined as follows[#可以定义如下:]
rownames0 <- function(x) dimnames(x)[[1]]
colnames0 <- function(x) dimnames(x)[[2]]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|