-3

I don't understand the use of exclamatory signs here.

x <- [!x %in% boxplot(x)$out]
Ritchie Sacramento
  • 29,890
  • 4
  • 48
  • 56

1 Answers1

2

! is nothing more than just a negation.

You should start from %in% if the example you gave is problematic for you.

vector1 <- c("a", "b")

vector2 <- c("c", "a")

vector1 %in% vector2 # for each element of vector1 do: is it in vector2?
#> [1]  TRUE FALSE

if you use ! now, i.e. negate the output, you will get:

!vector1 %in% vector2
#> [1] FALSE  TRUE
gss
  • 1,334
  • 6
  • 11