以正确的顺序组合两个向量

时间:2019-06-08 11:55:30

标签: r

例如,我有两个向量:

.panel {
  margin: 0% 0% 85% 0%;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 255, 0.5);
  border-radius: 10px;
}

我想将两个向量保持相同顺序:

  v1 <- c("a","j","d")
  v2 <- c("book","tree","river")

我尝试过:

  v3 <- c("a","book","j","tree","d","river")

但顺序错误

谢谢您的帮助。

1 个答案:

答案 0 :(得分:1)

v1 <- c("a","j","d")
v2 <- c("book","tree","river")
c(rbind(v1,v2))
# [1] "a"     "book"  "j"     "tree"  "d"     "river"