title: How to compare boolean vectors in R
body: <p>I have a vector <code>v</code> and I want to find all those elements, that have values between 4 and 7.
      v = c(1:9)</p>
  
  <pre><code># indices of elements with values larger than 4
  which(v &gt; 4)
  # indices of elements with values smaller than 7
  which(v &lt; 7)
  </code></pre>
  
  <p><code>v&gt;4</code> and <code>v&lt;7</code> give boolean vectors, which I'd like to combine. I tried the following, which did not work for me,...</p>
  
  <pre><code># combination?
  matching = which(v&gt;4 &amp;&amp; v&lt;7)  # does not work
  </code></pre>
  
  <p>How can I applay a boolean operation on two boolean vectors, that gives me a resulting vector?</p>