title: Performing binary function to a column in a data frame
body: <p>Say I have a data frame with the contents:</p>
  
  <pre><code>Trial Person 
  1     John   
  2     John   
  3     John   
  4     John
  1     Bill 
  2     Bill
  3     Bill
  4     Bill
  </code></pre>
  
  <p>and I want to transform this to</p>
  
  <pre><code>Trial Person Day
  1     John   1
  2     John   1
  3     John   2
  4     John   2
  1     Bill   1
  2     Bill   1
  3     Bill   2
  4     Bill   2
  </code></pre>
  
  <p>I can very easily make it</p>
  
  <pre><code>Trial Person Day
  1     John   TRUE
  2     John   TRUE
  3     John   FALSE
  4     John   FALSE
  1     Bill   TRUE
  2     Bill   TRUE
  3     Bill   FALSE
  4     Bill   FALSE
  </code></pre>
  
  <p>by doing <code>d$day=d$trial&lt;3</code> but how can I get to what I want?</p>