Subsetting a vector using multiple conditions
问题 > which(LETTERS=="A") [1] 1 > which(LETTERS=="B") [1] 2 Can i use one statement in which to get the value of 1,2? which(LETTERS=="B" or "A") Error: unexpected symbol in "which(LETTERS=="B" or" 回答1: which(LETTERS == "A" | LETTERS == "B") Or: which(LETTERS %in% c("A", "B")) 回答2: as answer for the title, how subsetting a vector using multiple conditions: # Random Data test1 <- sample(x = c(1:30),size = 15,replace = TRUE) test2 <- sample(x = c(70:75),size = 15,replace = TRUE) test3 <- sample(x =