标签: r concatenation
这可能非常简单但我真的卡住了:让我们说我有vector=c("a", "b", "c","d","e")。我怎样才能连接一些特定的元素?例如,我如何合并" b"和" c",这会引导我进入vector=c("a","bc","d","e")?
vector=c("a", "b", "c","d","e")
vector=c("a","bc","d","e")
谢谢
答案 0 :(得分:0)
我们可以做到
i1 <- vector %in% c("b", "c") c(vector[!i1], paste(vector[i1], collapse=""))