r语言没有c这个函数,R语言 c()函数 官方 说明文档

需要注意的是,cbind() 和rbind() 是考虑dim 特性的连接函数,而函数c() 则不考虑这些数值对象的dim 和dimnames 属性。这一点在有些时候非常有用。将一个数组强制转换成简单向量的标准方法是用函数as.vector()。

vec 一个相似效果的办法是采用单参数的c()函数,就像下面:

vec 这两种方法有少许不同,到底采用那种方式关键是看对结果向量的格式要求(建议使用前者)。

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类型 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 names(x) x

c(x) # has names[有名字]

as.vector(x) # no names[没有名字]

dim(x) x

c(x)

as.vector(x)

append to a list:[#附加到一个列表:]

ll

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)。

http://www.biostatistic.net/thread-2396-1-1.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值