title: Check whether two vectors contain the same (unordered) elements in R
body: <p>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 <code>SameElements</code>) should satisfy these criteria:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Edit 1: Specified that function should return F when the vectors contain the same elements, but with different frequencies.</p>
  
  <p>Edit 2: Cleaned up question to omit initial answer, as this is now in my actual answer.</p>