title: How to join data.table by one column of multi-column key
body: <p>Suppose I have a data.table with an id column, a date column and a value column. It is keyed by id and then date. I want to extract only certain dates. Is there a way to join on the second column of the key only, ignoring the first? </p>
  
  <p>For example,</p>
  
  <pre><code>values &lt;- data.table(id = rep(1:2, each = 10), dates = rep(1:10, 2), values = rep(c(1,NA,NA, NA), 5))
  setkey(values, id, dates)
  
  dates &lt;- data.table(id = c(1,5,8))
  setkey(dates, id)
  
  # what i want
  x &lt;- values$dates %in% dates$id
  values[x]
  </code></pre>
  
  <p>Thanks!</p>