title: (R) Count Gaps in Between Months
body: <p>I have a dataset that looks like the sample below. The MonthYear variable just describes the first occurrence of the UniqueID.  The Count1 column counts the number of occurrences of the UniqueID.  The Count2 column counts the total number of occurrences of each UniqueID.  The MonthCount variable just assigns a number based on the month.  I started collecting this information in October 2018, so that value would get a 1 and then November 2018 would get a 2, and so on.  </p>
  
  <p>Note: No data was available in both July 2019 and October 2019, so August 2019 gets a value of 10 and November 2019 gets a value of 12.</p>
  
  <pre><code>UniqueID Region City MonthYear Count1 Count2 MonthCount
  ABC123   West   AAA  OCT-18    1      4      1
  ABC123   West   AAA  NOV-18    2      4      2
  ABC123   West   AAA  DEC-18    3      4      3 
  ABC123   West   AAA  JAN-19    4      4      4
  DEF456   East   BBB  DEC-18    1      3      3 
  DEF456   East   BBB  JAN-19    2      3      4
  DEF456   East   BBB  MAR-19    3      3      6
  GHI789   East   CCC  JAN-19    1      4      4
  GHI789   East   CCC  FEB-19    2      4      5
  GHI789   East   CCC  APR-19    3      4      7
  GHI789   East   CCC  JUN-19    4      4      9
  JKL012   South  DDD  AUG-19    1      4      10 
  JKL012   South  DDD  SEP-19    2      4      11
  JKL012   South  DDD  NOV-19    3      4      12
  JKL012   South  DDD  DEC-19    4      4      13 
  </code></pre>
  
  <p>What I want to do is count the total number of times a month is skipped per UniqueID (with the exception of JUL19 and OCT19).  I would have a dataset that looks like the following:</p>
  
  <pre><code>UniqueID Region City MonthYear Count1 Count2 MonthCount Skipped
  ABC123   West   AAA  OCT-18    1      4      1          0      
  ABC123   West   AAA  NOV-18    2      4      2          0
  ABC123   West   AAA  DEC-18    3      4      3          0
  ABC123   West   AAA  JAN-19    4      4      4          0
  DEF456   East   BBB  DEC-18    1      3      3          1
  DEF456   East   BBB  JAN-19    2      3      4          1
  DEF456   East   BBB  MAR-19    3      3      6          1 
  GHI789   East   CCC  JAN-19    1      4      4          2
  GHI789   East   CCC  FEB-19    2      4      5          2
  GHI789   East   CCC  APR-19    3      4      7          2
  GHI789   East   CCC  JUN-19    4      4      9          2
  JKL012   South  DDD  AUG-19    1      4      10         0 
  JKL012   South  DDD  SEP-19    2      4      11         0
  JKL012   South  DDD  NOV-19    3      4      12         0
  JKL012   South  DDD  DEC-19    4      4      13         0
  </code></pre>
  
  <p>Any help would be appreciated!  I'm not sure where to start.  Thank you!</p>