title: Compare two character vectors matching names
body: <p>I have two character vectors with the different set of names and values:</p>
  
  <pre><code>x &lt;- c("a", "b", "c", "d", "e")
  names(x) &lt;- c("foo", "bar", "baz", "qux", "grault")
  
  y &lt;- c("c", "a", "d", "b")
  names(y) &lt;- c("bar", "foo", "qux", "corge")
  </code></pre>
  
  <p>Is there a way to compare <code>x</code> and <code>y</code> so that we know their values corresponding to the name <code>bar</code> are different because here <code>x.bar = "b"</code> and <code>y.bar = "c"</code>? Please note the names are not ordered. I tried <code>setdiff</code> and <code>which(x != y)</code> but neither one gives me the correct answer. Thanks!</p>