I'd like to check whether two vectors contain the same elements, even if they're not ordered the same. For example, the function (let's call it `SameElements`

) should satisfy these criteria:

```
SameElements(c(1, 2, 3), c(1, 2, 3)) # TRUE
SameElements(c(1, 2, 3), c(3, 2, 1)) # TRUE
SameElements(c(1, 2, 1), c(1, 2)) # FALSE
SameElements(c(1, 1, 2, 3), c(3, 2, 1)) # FALSE
```

Edit 1: Specified that function should return F when the vectors contain the same elements, but with different frequencies.

Edit 2: Cleaned up question to omit initial answer, as this is now in my actual answer.

`all(a %in% b)`

. It basically answers the questionAre all the elements ofIf the values are unique then you could also use something like`a`

contained in the vector`b`

?`anyNA(match(a,b))`