x1 = c(1,2,3,4,5,6,7)
x1
[1] 1 2 3 4 5 6 7
x1[which(x1== c(5,6))]
[1] 5 6
Warning message:
In x1 == c(5, 6) :
longer object length is not a multiple of shorter object length
当我退出 R 然后重新打开 RI 得到这个:
x1 = c(1,2,3,4,5,6,7)
x1
[1] 1 2 3 4 5 6 7
x1[which(x1== c(5,6))]
[1] 5 6
警告消息消失。为什么?