title: Populate a column using if statements in r
body: <p>I have quite a simple question which I am currently struggling with.  If I have an example dataframe:</p>
  
  <pre><code>a &lt;- c(1:5)  
  b &lt;- c(1,3,5,9,11)
  df1 &lt;- data.frame(a,b)
  </code></pre>
  
  <p>How do I create a new column ('c') which is then populated using if statements on column b.  For example:
  'cat' for those values in b which are 1 or 2
  'dog' for those values in b which are between 3 and 5
  'rabbit' for those values in b which are greater than 6</p>
  
  <p>So column 'c' using dataframe df1 would read: cat, dog, dog, rabbit, rabbit.</p>
  
  <p>Many thanks in advance.</p>