title: Create new column with binary data or presence/absence data in R
body: <p>The answer to the following question has been addressed more simply than this answer: <a href="https://stackoverflow.com/questions/16222438/create-new-column-with-binary-data-based-on-several-columns">Create new column with binary data based on several columns</a></p>
  
  <p>I am trying to create a new column of binary data (presence/absence data) based on another column in <strong>R</strong>.</p>
  
  <p>I want "Species_code" rows with the number 101 to produce a 1 in the new "Presence_absence" column; everything else should produce a 0.</p>
  
  <p>Here is what I want the new Presence_absence column to look like:</p>
  
  <pre><code>Species_code       Presence_absence
  101                1
  103                0
  101                1
  99                 0
  101                1
  </code></pre>