title: multiple ifelse condtion in r
body: <p>I am trying to use if-else to recode a column based on two conditions. Here is an example of data. </p>
  
  <pre><code>score.1 &lt;- c(1,2,3,4,5,6,7,8,9,10)
  cat &lt;- c("a","b","c","d","e","a","b","c","d","e")
  
  data &lt;- data.frame("score.1"=score.1,"cat"=cat)
  
  cut.score.1 &lt;- 2.5
  cut.score.2 &lt;- 7.5
  
  data[,1] &lt;- ifelse(data[,1] &lt; cut.score.1, data[,1] == cut.score.1, data[,1])
  data[,1] &lt;- ifelse(data[,1] &gt; cut.score.2, data[,1] == cut.score.2, data[,1])
  
  &gt; data[,1]
   [1] 0 0 3 4 5 6 7 0 0 0
  </code></pre>
  
  <p>However, when the condition/s meet, Os are printed. Any thoughts on that?</p>
  
  <p>Thanks</p>