title: How to remove outliers along with factor variables?
body: <p>I am trying to remove outliers from a dataset <code>s</code> consisted of 3 variables:</p>
  <pre><code>id consumption period
   a      0.1    summer
   a      0.2    summer
   b      0.3    summer
   a      0.4    winter
   b      10     winter
   c      12     winter 
  </code></pre>
  <p>I used <code>outliers &lt;- s$consumption[!s$consumption %in% boxplot.stats(s$consumption)$out]</code> to remove the outliers from <code>s</code> and got something like this:</p>
  <pre><code>consumption
     0.1
     0.2
     0.3
     0.4
  </code></pre>
  <p>However, I want to get something like this below:</p>
  <pre><code>id consumption period
   a      0.1    summer
   a      0.2    summer
   b      0.3    summer
   a      0.4    winter
  </code></pre>
  <p>But the <code>$out</code> function only allows me to remove the column with numbers (not with factors).</p>