📜  从字符向量中删除元素 - R 编程语言代码示例

📅  最后修改于: 2022-03-11 14:51:59.601000             🧑  作者: Mango

代码示例1
x<-c(2, 4, 6, 9, 10) # the list
y<-c(4, 9, 10) # values to be removed

idx = which(x %in% y) # Positions of the values of y in x
x = x[-idx] # Remove those values using their position and "-" operator


x = x[ - which(x %in% y)] # In short
x = x[! x %in% y] # You can also try