title: How to iterate through data frame on R and remove certain vaules
body: <p>I am trying to iterate through a data frame on R and remove all values below a certain threshold (.2). Filter doesn't work as it removes the entire rows that contain such values, but I only want to remove the individual data points. </p>
  
  <p>I receive this error message for the if statement and have no idea why:</p>
  
  <p>missing value where TRUE/FALSE needed</p>
  
  <p>My code so far:</p>
  
  <pre><code>    bigpeak&lt;- function(x){
        for(i in nrow(x)){
          for(j in ncol(x)){
            if (x[i, j] &lt; .2){
              (x[i, j] == NA)
            }
          }
        }
  </code></pre>