title: Efficiently combining multiple conditions on R data.frame
body: <p>I'm working with data frames in R and often use a lot of conditions on my dataframes, mainly <code>&amp;</code> and <code>|</code> operators. I'm doing that like so: </p>
  
  <pre><code>df = data.frame("col1"=c("success", "failure", "success"), "col2"=c("success", "success", "failure"), "col3"=c(1,1,100))
  #multiple conditions, option 1
  df[(df[["col1"]]=="success") &amp; (df[["col2"]]=="success") &amp; (df[["col3"]] == 1), ]
  #multiple conditions, option 2
  df[which((df[["col1"]]=="success") &amp; (df[["col2"]]=="success") &amp; (df[["col3"]] == 1)),]
  </code></pre>
  
  <p>However, my expressions tend to get really long and hard to read that way. </p>
  
  <ul>
  <li>Is there a better, more readable way of doing it?</li>
  <li>EDIT: Preferably, I'd like to work within the base R environment w/out external libraries. </li>
  </ul>
  
  <p>I put this together based on other posts here on SO about <a href="https://stackoverflow.com/questions/9860090/why-is-better-than-subset">not using subset</a>, <a href="https://stackoverflow.com/questions/4935479/how-to-combine-multiple-conditions-to-subset-a-data-frame-using-or">using | correctly</a>, but didnt' find anything addressing this specific issue. </p>
  
  <p>I hope this is not too opinion-based, otherwise I'll retract my question. Thanks!</p>