title: R - sapply function with multiple arguments
body: <p>I have a similar, but not quite the same question to <a href="https://stackoverflow.com/questions/6827299/r-apply-function-with-multiple-parameters">R apply function with multiple parameters</a></p>
  
  <p>I have a dataset with two variables RSHIFTSTART and RSHIFTEND (amongst other variables).
  These variables contain times eg. 23:30:00 or 00:00:00.
  I'd like to replace RSHIFTSTART and RSHIFTEND with NA wherever BOTH variables are zero ie. '00:00:00'.</p>
  
  <p>I've written a function which I think may do the job:</p>
  
  <pre><code># Change '00:00:00' to NA where both variables are '00:00:00'
  zeroTime=function(x,y) {
      if (x=='00:00:00' &amp; y=='00:00:00') {
          replace(x,x=='00:00:00',NA)
          replace(y,x=='00:00:00',NA)
      }
  }
  </code></pre>
  
  <p>My question is how to apply this function to update the dataset's variable ie. supplying two arguments to it. I tried:</p>
  
  <pre><code>sapply(rosterSample$RSHIFTSTART,rosterSample$RSHIFTEND,zeroTime)
  </code></pre>
  
  <p>but this syntax is incorrect. Perhaps I'll be restricted to changing just one variable per call ie. RSHIFTSTART or RSHIFTEND, that's OK.</p>
  
  <p>Any ideas?
  Thanks
  Pete</p>