I am not sure I understand the behaviour of the minus sign.
x <- 10:1
y <- c(4, 7)
x[y]
# [1] 7 4
x[-y]
# [1] 10 9 8 6 5 3 2 1
So the - sign in x[-y] is understood as items of x that are not y.
x <- 10:1
y <- 1:10
x[-y]
# integer(0)
Again logical, if y has all the element of x, x[-y] should be empty.
Now if y is itself empty, you'd expect that x[-y] should list all the elements of x.
However:
x <- 10:1
y <- integer()
x[-y]
# integer(0)
What is it that I am not understanding?
Is there any other operator to do what I want (i.e. list the elements of x that are not in y, and thus list all elements of x is y is empty)?