title: Replace values in dataframe below a row wise threshold R
body: <p>I have a dataframe (intensities) in which I want to replace all values below a row-wise threshold  with 0. The threshold is 80% of the maximum value of the respective row. The result should be safed as a new dataframe</p>
  
  <p>I tried this:</p>
  
  <pre><code>cutoff &lt;- function(x){
   x[x &lt; 0.8* max(x)] &lt;- 0
  } 
  
  filter_int &lt;- t(apply(X= intensities, MARGIN = 1, FUN= cutoff))
  </code></pre>
  
  <p>running this, filter_int is one row  with all zeroes. Any ideas? </p>