title: remove rows containing certain data
body: <p>In my data frame the first column is a factor and I want to delete rows that have a certain value of <em>factorname</em> (when the value is present). I tried: </p>
  
  <pre><code>df &lt;- df[-grep("factorname",df$parameters),]
  </code></pre>
  
  <p>Which works well when the targeted factor name is present. However if the <em>factorname</em> is absent, this command destroys the data frame, leaving it with 0 rows. So I tried: </p>
  
  <pre><code>df &lt;- df[!apply(df, 1, function(x) {df$parameters == "factorname"}),]
  </code></pre>
  
  <p>that does not remove the offending lines. How can I test for the presence of <em>factorname</em> and remove the line if <em>factorname</em> is present?</p>