Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 在R中将多个字符串连接成一个字符串_String_R_Merge_Character - Fatal编程技术网

String 在R中将多个字符串连接成一个字符串

String 在R中将多个字符串连接成一个字符串,string,r,merge,character,String,R,Merge,Character,我知道paste()可以将多个字符串连接成一个字符串。比如说 > paste("a", "b", "c") [1] "a b c" 现在,我有一个向量 c = c("a", "b", "c") 我想把c转换成“abc”,我不能使用粘贴(c),它对c没有任何作用 我该怎么办?您需要使用折叠参数: paste(c("a", "b", "c"), collapse=" ") # [1] "a b c" 我怎么又忘了呢!谢谢

我知道paste()可以将多个字符串连接成一个字符串。比如说

> paste("a", "b", "c")
[1] "a b c"
现在,我有一个向量

c = c("a", "b", "c")
我想把c转换成“abc”,我不能使用粘贴(c),它对c没有任何作用


我该怎么办?

您需要使用
折叠
参数:

paste(c("a", "b", "c"), collapse=" ")
# [1] "a b c"

我怎么又忘了呢!谢谢