title: How to calculate difference between two timestamp columns depending on value of third column?
body: <p>I have a dataframe:</p>
  <pre><code>col1                                      col2               col3
  2019-04-26 12:37:11.52000      2019-04-27 12:37:11.52000          2
  2019-04-28 12:37:11.52000      2019-04-30 12:37:11.52000          1
  2019-05-03 12:37:11.52000      2019-05-08 12:37:11.52000          2
  NA                             2019-05-08 12:37:11.52000          2
  </code></pre>
  <p>I want to create new column as difference of col2 and col1. Im going to use difftime function. However, I want there be values only if in that row value in col3 is 2. Otherwise it must be NA. So, desired result is:</p>
  <pre><code>col1                                      col2                  col3    diff
  2019-04-26 12:37:11.52000      2019-04-27 12:37:11.52000          2      1
  2019-04-28 12:37:11.52000      2019-04-30 12:37:11.52000          1      NA
  2019-05-03 12:37:11.52000      2019-05-08 12:37:11.52000          2      5
  NA                             2019-05-08 12:37:11.52000          2      NA
  </code></pre>
  <p>How to do that? How to add that condition?</p>