title: Create new column in dataframe based on partial string matching other column
body: <p>I have a dataframe with 2 columns <code>GL</code> and <code>GLDESC</code> and want to add a 3rd column called <code>KIND</code> based on some data that is inside of column <code>GLDESC</code>.</p>
  
  <p>The dataframe is as follows:</p>
  
  <pre><code>      GL                             GLDESC
  1 515100         Payroll-Indir Salary Labor
  2 515900 Payroll-Indir Compensated Absences
  3 532300                           Bulk Gas
  4 539991                     Area Charge In
  5 551000        Repairs &amp; Maint-Spare Parts
  6 551100                 Supplies-Operating
  7 551300                        Consumables
  </code></pre>
  
  <p>For each row of the data table:</p>
  
  <ul>
  <li>If <code>GLDESC</code> contains the word <code>Payroll</code> anywhere in the string then I want <code>KIND</code> to be <code>Payroll</code></li>
  <li>If <code>GLDESC</code> contains the word <code>Gas</code> anywhere in the string then I want <code>KIND</code> to be <code>Materials</code></li>
  <li>In all other cases I want <code>KIND</code> to be <code>Other</code></li>
  </ul>
  
  <p>I looked for similar examples on stackoverflow but could not find any, also looked in <code>R</code> for dummies on switch, grep, apply and regular expressions to try and match only part of the <code>GLDESC</code> column and then fill the <code>KIND</code> column with the kind of account but was unable to make it work.</p>