Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
重複の可能性: ベクトルから複数の値を削除するには?
vector 内の特定の要素グループを削除できる組み込み関数はありますか?
例:
x<-c(2, 4, 6, 9, 10)
c(4,9,10)からベクトルを削除しますx
c(4,9,10)
x
あなたはこれを多くの方法で行うことができます:
x[!x %in% c(4, 9, 10)]
または、使用することもできます?is.element
?is.element
x[!is.element(x, c(4,9,10))]
これは役に立つかもしれません
x<-c(2, 4, 6, 9, 10) y <- c(4,9,10) setdiff(x, y) 2 6