title: Count duplicates based on condition in R
body: <p>I want to count column <code>d</code> where duplicate values are available with conditions like 1) <code>a = 3w1</code> and <code>a = 7w1</code> 2) <code>a = 3w1</code> and <code>a = sp2</code> 3) <code>a = 3W1</code> and <code>a = 3W1</code> and so forth. So, that each id in column <code>d</code> can be calculated in each interaction of column <code>a</code>.</p>
  <p>I can extract or count the duplicates based on the overlapping dates, which might be more meaningful, but I am getting errors with dates. d is overlapped in 3W1, 7W1, 5W1, 14W. I sed <code>library(dplyr)</code>.</p>
  <pre><code>a     b         c         d
  3W1  5/11/2020 5/31/2020  1
  3W1  5/11/2020 5/31/2020  1
  7W1  5/11/2020 6/28/2020  1
  5W1  6/1/2020  7/5/2020   1
  14W  5/11/2020 8/16/2020  1
  3W1  5/11/2020 5/31/2020  2
  SP2  6/15/2020 8/16/2020  3
  3W1  5/11/2020 5/31/2020  4
  3W1  5/11/2020 5/31/2020  4
  </code></pre>