title: How do you determine which element in a list contains a value matching some other value?
body: <p>If I have the following list:</p>
  
  <pre><code>a &lt;- list(1:3, 4:5, 6:9)
  
  a
  [[1]]
  [1] 1 2 3
  
  [[2]]
  [1] 4 5
  
  [[3]]
  [1] 6 7 8 9
  </code></pre>
  
  <p>I want to determine which element of the list a specific value is in. For example, I might want to find which element the number 5 falls under. In this case it would be <code>[[2]]</code>. </p>
  
  <p>My goal is to have something like </p>
  
  <pre><code>match(5,a)
  </code></pre>
  
  <p>return the value <code>2</code>. </p>
  
  <p>However, this code only checks whether the selected number exists as a complete element of a given element</p>
  
  <pre><code>match(5,a)
  [1] NA 
  </code></pre>
  
  <p>Further, unlist only tells me where in the entire length of all values my number of interest falls:</p>
  
  <pre><code>match(5,unlist(a))
  [1] 5
  </code></pre>
  
  <p>Thoughts?</p>