title: how to combine two levels in one categorical variable in R
body: <p>I am now learning R, and I have problem with finding a command.</p>
  
  <p>I have the categorical data</p>
  
  <pre><code>levels(job)
  [1] "admin."        "blue-collar"   "entrepreneur"  "housemaid"    
  [5] "management"    "retired"       "self-employed" "services"     
  [9] "student"       "technician"    "unemployed"    "unknown"
  </code></pre>
  
  <p>now I want to simplify these levels, such as </p>
  
  <pre><code>levels(job) 
  [1] "class1"  "class2" "class3" "unknown"
  </code></pre>
  
  <p>where <code>type1</code> includes <code>"admin."</code>, <code>"entrepreneur"</code>, and <code>"self-employed"</code>;
    <code>type2</code> includes <code>"blue-collar"</code>,<code>"management"</code>, and <code>"technician"</code>;
    <code>type3</code> includes <code>"housemaid"</code>, <code>"student"</code>, <code>"retired"</code>, and <code>"services"</code>;
    <code>unknown</code> includes <code>"unknown"</code> and <code>"unemployed"</code>.</p>
  
  <p>For this purpose, which command can I use? 
  Thanks!
   Yan</p>