title: Subset dataframe based on level of a factor
body: <p>I have dataframe <code>df1</code>:</p>
  <pre><code>df1 &lt;- data.frame(respondent = factor(c(1, 2, 3, 4, 5, 6, 7)),
                   location = factor(c(&quot;California&quot;, &quot;Oregon&quot;, &quot;Oregon&quot;,
                                       &quot;Texas&quot;, &quot;Oregon&quot;, &quot;Mexico&quot;, &quot;Canada&quot;)))
  </code></pre>
  <p>I want to subset it so that only rows with level <code>Oregon</code> of factor <code>location</code> remain in the dataframe:</p>
  <pre><code>df2 &lt;- data.frame(respondent = factor(c(2, 3, 5)),
                   location = factor(c(&quot;Oregon&quot;, &quot;Oregon&quot;,
                                       &quot;Oregon&quot;)))
  </code></pre>
  <p>What's the most straightforward way to subset a dataframe based on a level of a dataframe?</p>