R语言paste函数解析

一、paste函数

paste (..., sep = " ", collapse = NULL)

paste0(..., collapse = NULL)

paste converts its arguments (via as.character) to character strings, and concatenates them (separating them by the string given by sep). If the arguments are vectors, they are concatenated term-by-term to give a character vector result. Vector arguments are recycled as needed, with zero-length arguments being recycled to "".
Note that paste() coerces NA_character_, the character missing value, to "NA" which may seem undesirable, e.g., when pasting two character vectors, or very desirable, e.g. in paste("the value of p is ", p).
paste0(..., collapse) is equivalent to paste(..., sep = "", collapse), slightly more efficiently.paste

paste函数将他的参数转换为字符串并连接他们,字符串之间用seq间隔分开。

当参数是多个向量时,分别取每个参数中索引为0的连接起来,如果规定了seq,他们之间用seq间隔,如此循环下去若规定了collapse参数,每个有参数连接的结果用collapse连接。




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值