0

what is analogous command to %in% but which means that something is not in certain set ? Something like 'k' %not_in% c('a','b') ?

John
  • 1,849
  • 2
  • 13
  • 23

1 Answers1

2

See if this answers:

> '%not_in%' <- function(a,b){
+   !(a%in%b)
+ }
> 'k' %not_in% c('a','b')
[1] TRUE
> 'k' %not_in% c('a','b','k')
[1] FALSE
> c('a','c') %not_in% c('b','z','k','a','f','c')
[1] FALSE FALSE
Karthik S
  • 11,348
  • 2
  • 11
  • 25