Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个向量
一个<-{1,2,5,6,7}
b<-包含上述值的映射作为 b 的索引
我想在与“a”的值匹配时提取“b”的索引,例如,如果“a”中的值 2 与“b”中的索引 8 处的值匹配,则想提取“8”
我是 R 的新手,所以正在寻找解决方案
我认为你想要的是这样的:
a <- c(1, 2, 5, 6, 7) b <- c(2, 3, 5, 9) match(a, b)