title: how to remove the negative values from a data frame in R
body: <p>I want to remove the negative values from a dataframe and then I need to calculate the mean of each row separately (mean of positive values for each row)
  I wrote this to remove negative values but it didn't work. I have a warning like that : </p>
  
  <blockquote>
    <p>Error in <code>[&lt;-.data.frame</code>(<code>*tmp*</code>, i, j, value = NULL) : 
      replacement has length zero</p>
  </blockquote>
  
  <p>How can I fix this problem?</p>
  
  <pre><code>for (i in 1:1000) {
    for(j in 1:20){
       if (dframe[i,j]&lt;=0) dframe[i,j]&lt;-NULL
       j=j+1
    }
    i=i+1
  }
  </code></pre>