title: Grouping regions according to area codes in statistical program R
body: <p>I want to create an area group according to the areacode.
  By doing this, all area_g becomes A.
  Only codes 50110250, 50110253, 50110310 should be A!
  and 50110101~50110140 should be 'B'.
  what's wrong...
  This is the code I wrote. Thank you.</p>
  <pre><code>     AAA &lt;- AAA %&gt;%
    
        mutate(AAA, area_g = ifelse(areacode==50110250|50110253|50110310, &quot;A&quot;,
                                ifelse(areacode==50110101:50110140, &quot;B&quot;,
                                 ifelse(areacode==50110256|50110253, &quot;C&quot;,
                                  ifelse(areacode==50130250|50130310, &quot;D&quot;,
                                   ifelse(areacode==50130101:50130122, &quot;E&quot;,
                                    ifelse(areacode==50130253|50130259|50130320, &quot;F&quot;)))))))   
  </code></pre>