我有两个不同的向量,我从中索引了完美匹配的所有可能组合:
starts <- c(54, 54, 18, 20, 22, 22, 33, 33, 33, 37, 42, 44, 44, 51, 11, 17, 19, 19, 19, 19, 22, 23, 23, 24, 24)
ends <- c(22, 14, 14, 14, 14, 14, 14, 14, 14, 24, 24, 25, 25, 25, 25, 26, 26, 29, 30, 31, 32, 33, 33, 33, 33)
which(outer(starts, ends, "=="), arr.ind=TRUE)
现在,我不想尝试找到完全匹配,而是想找到彼此处于一定范围内的组件组合:比如 +/- 5。我已经制定了一个范围 (-5:5) 并尝试引入它作为一个代替“==”的函数,但它并没有真正奏效。
非常感谢。