c(base)
c()所属R语言包:base
Combine Values into a Vector or List
结合成一个向量或列表值
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This is a generic function which combines its arguments.
这是一个通用的功能,结合其参数。
The default method combines its arguments to form a vector. All arguments are coerced to a common type which is the type of the returned value, and all attributes except names are removed.
默认的方法,结合它的参数,以形成一个向量。所有的参数被强制到一个共同的类型是返回值的类型,除名称外,所有属性将被删除。
用法----------Usage----------
c(..., recursive=FALSE)
参数----------Arguments----------
参数:...
objects to be concatenated.
要连接的对象。
参数:recursive
logical. If recursive = TRUE, the function recursively descends through lists (and pairlists) combining all their elements into a vector.
逻辑。如果recursive = TRUE,函数的递归下降通过结合成一个向量元素(和pairlists)的名单。
Details
详情----------Details----------
The output type is determined from the highest type of the components in the hierarchy NULL < raw < logical < integer < real < complex < character < list < expression. Pairlists are treated as lists, but non-vector components (such names and calls) are treated as one-element lists which cannot be unlisted even if recursive = TRUE.
输出类型决定从最高的组件层次结构中的NULL类型<原料<逻辑<整数<真正复杂的<字符<列表<表达。的pairlists名单,但被视为非向量组件(如姓名,电话)作为一个元素列表,而不能是未上市,甚至如果recursive = TRUE治疗。
c is sometimes used for its side effect of removing attributes except names, for example to turn an array into a vector. as.vector is a more intuitive way to do this, but also drops names. Note too that methods other than the default are not required to do this (and they will almost certainly preserve a class attribute).
c有时其副作用,除了名称删除属性,例如变成一个向量数组。 as.vector是一个更直观的方式做到这一点,但也下降名称。太注意默认以外的方法,并不需要做到这一点(和他们几乎肯定会维持一个类的属性)。
This is a primitive function.
这是一种原始的功能。
值----------Value----------
NULL or an expression or a vector of an appropriate mode. (With no arguments the value is NULL.)
NULL或适当的方式表达或向量。 (不带参数的值是NULL。)
S4方法----------S4 methods----------
This function is S4 generic, but with argument list (x, ..., recursive = FALSE).
此功能是S4通用的,但参数列表(x, ..., recursive = FALSE)。
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
参见----------See Also----------
unlist and as.vector to produce attribute-free vectors.
unlist和as.vector属性的向量。
举例----------Examples----------
c(1,7:9)
c(1:5, 10.5, "next")
## uses with a single argument to drop attributes[#使用一个参数,删除属性]
x <- 1:4
names(x) <- letters[1:4]
x
c(x) # has names[有名字]
as.vector(x) # no names[没有名字]
dim(x) <- c(2,2)
x
c(x)
as.vector(x)
## append to a list:[#附加到一个列表:]
ll <- list(A = 1, c="C")
## do *not* use[#*不*使用]
c(ll, d = 1:3) # which is == c(ll, as.list(c(d=1:3))[这是== C(LL,as.list(C(D = 1:3))]
## but rather[#而是]
c(ll, d = list(1:3))# c() combining two lists[C()相结合的两个列表]
c(list(A=c(B=1)), recursive=TRUE)
c(options(), recursive=TRUE)
c(list(A=c(B=1,C=2), B=c(E=7)), recursive=TRUE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|