title: Using dplyr-like commands to organise raster data in R
body: <p>I've got three global soil texture rasters (<code>sand</code>, <code>clay</code> and <code>silt</code>). I want to merge these rasters into one raster with two categories (<code>coarse</code> and <code>fine</code>) based on relative percentages of <code>sand</code>, <code>clay</code> and <code>silt</code>. I've done this before when working with <a href="/questions/tagged/dataframe" class="post-tag" title="show questions tagged &#39;dataframe&#39;" rel="tag">dataframe</a> in this way:</p>
  
  <pre><code>kiwi &lt;- kiwi %&gt;% mutate(group = case_when(
  clay_value_avg &lt; 20  ~ "coarse",
  silt_value_avg &gt; 80 ~ "coarse",
  clay_value_avg &gt; 20 ~ "fine",
  silt_value_avg &lt; 80 ~ "fine"
  ))
  </code></pre>
  
  <p>Can I do something like this with <a href="/questions/tagged/raster" class="post-tag" title="show questions tagged &#39;raster&#39;" rel="tag">raster</a>? Thanks,</p>