在下面这个非常简单的例子中,我无法理解"=="运算符的行为.
A <- c(10, 20, 10, 10, 20, 30)
B <- c(40, 50, 60, 70, 80, 90)
df <- data.frame(A, B)
df[df$A == c(10,20), ] # it returns 3 lines instead of 5
df[df$A %in% c(10,20), ] # it works properly and returns 5 lines
Run Code Online (Sandbox Code Playgroud)
大家先谢谢大家.
r ×1