title: Partial animal string matching in R
body: <p>I have a dataframe,</p>
  
  <pre><code>d&lt;-data.frame(name=c("brown cat", "blue cat", "big lion", "tall tiger",
                       "black panther", "short cat", "red bird",
                       "short bird stuffed", "big eagle", "bad sparrow",
                       "dog fish", "head dog", "brown yorkie",
                       "lab short bulldog"), label=1:14)
  </code></pre>
  
  <p>I'd like to search the <code>name</code> column and if the words
  "cat", "lion", "tiger", and "panther" appear, I want to assign the character string <code>feline</code> to a new column and corresponding row <code>species</code>.</p>
  
  <p>If the words <code>"bird", "eagle", and "sparrow"</code> appear, I want to assign the character string <code>avian</code> to a new column and corresponding row <code>species</code>.</p>
  
  <p>If the words "dog", "yorkie", and "bulldog" appear, I want to assign the character string <code>canine</code> to a new column and corresponding row <code>species</code>.</p>
  
  <p>Ideally, I'd store this in a list or something similar that I can keep at the beginning of the script, because as new variants of the species show up in the name category, it would be nice to have easy access to update what qualifies as a <code>feline</code>, <code>avian</code>, and <code>canine</code>.</p>
  
  <p>This question is almost answered here (<em><a href="https://stackoverflow.com/questions/19747384/how-to-create-new-column-in-dataframe-based-on-partial-string-matching-other-col">How to create new column in dataframe based on partial string matching other column in R</a></em>), but it doesn't address the multiple name twist that is present in this problem.</p>