开发者

How do concat a vector of character in R?

开发者 https://www.devze.com 2023-01-07 05:48 出处:网络
Itried using the paste command but it returns the same 开发者_StackOverflow社区vector? x = c(\"a\",\"b\",\"c\")

I tried using the paste command but it returns the same 开发者_StackOverflow社区vector?

x = c("a","b","c")
y = paste(x)
y
[1] "a" "b" "c"
length(y)
[1] 3

I want a single character of "abc"


The collapse="" options is your friend:

> x <- c("a", "b", "c")
> paste(x, collapse="")
[1] "abc"
> 

[ There is still no rstats tag here. ]

0

精彩评论

暂无评论...
验证码 换一张
取 消