title: Mutate data conditionally in dplyr
body: <p>I am trying to mutate data by dividing based on an identifier.
  For example, I would like to mutate <code>mass</code> in the following data.  If it is depth 10, I would like to divide by 2.  If it is depth 20, I would like to divide by 3.</p>
  
  <pre><code>day    year    depth    mass 
  1      2008    10       13
  2      2008    10       15
  1      2008    20       14
  2      2008    20       12
  1      2009    10       14
  2      2009    10       16
  1      2009    20       12
  2      2009    20       18   
  </code></pre>
  
  <p>Division leads to:</p>
  
  <pre><code>day    year    depth    mass 
  1      2008    10      6.5
  1      2008    10      6.5
  2      2008    10      7.5
  2      2008    10      7.5
  1      2008    20      4.6
  1      2008    20      4.6
  2      2008    20      4
  2      2008    20      4
  1      2009    10      7
  1      2009    10      7
  2      2009    10      8
  2      2009    10      8   
  1      2009    20      4
  1      2009    20      4  
  2      2009    20      6 
  2      2009    20      6  
  </code></pre>
  
  <p>I am trying <code>ifelse</code> in the following way, but get an error "unused arguments(c(13, 15, 14. . .)"</p>
  
  <pre><code>df%&gt;% 
    group_by(day, year, depth) %&gt;% 
    bind_rows(., .) %&gt;%
    mutate(mass = ifelse(depth == 10), mass/2,
           ifelse(depth == 20), mass/3)%&gt;%
    arrange(day, year, depth, mass)
  </code></pre>