title: Create column with grouped values based on another column
body: <p>I'm sure this has been asked before, but I don't know what to search for, so I apologise in advance. </p>
  
  <p>Let's say that I have the following data frame: </p>
  
  <pre><code>grades &lt;- data.frame(a = 1:40, b = sample(45:100, 40))
  </code></pre>
  
  <p>Using deplyr, I want to create a new variable that indicates the grade the student received, based on the following criteria: 90-100 = excellent, 80-90 = very good, etc. </p>
  
  <p>I thought I could use the following to get that result with nestling ifelse() inside of mutate():</p>
  
  <pre><code>grades %&gt;%
  mutate(ifelse(b &gt;= 90, "excellent"), 
         ifelse(b &gt;= 80 &amp; b &lt; 90, "very_good"),
         ifelse(b &gt;= 70 &amp; b &lt; 80, "fair"),
         ifelse(b &gt;= 60 &amp; b &lt; 70, "poor", "fail"))
  </code></pre>
  
  <p>This doesn't work, as I get the error message "argument no is missing, with no default"). I thought the "no" would be the "fail" at the end, but obviously I'm getting the syntax wrong. </p>
  
  <p>I can get this to get if I first filter the original data individually, and then call ifelse, as follows: </p>
  
  <pre><code>a &lt;- grades %&gt;%
       filter( b &gt;= 90) %&gt;%
       mutate(final = ifelse(b &gt;= 90, "excellent"))
  </code></pre>
  
  <p>and the rbind a, b, c, etc. Obviously,this isn't how I want to do it, but I wanted to understand the syntax of ifelse(). I'm guessing the latter works because there aren't any values that don't fill the criteria, but I still can't figure out how to get it to work when there is more than one ifelse.  </p>