title: how can I extract a subset based on values of a column with more than one frequency?
body: <p>I have a data frame (my_data) same as below:</p>
  <pre><code>No.       Id         X     Y         Z        Cat
  1      A2_A0CX      A2  2010-06-16  A00Z      cat1
  2      A8_A076      A8  2010-06-16  A00Z      cat2
  3      A8_A07B      A8  2010-06-16  A00Z      cat2
  4      A8_A07I      A8  2010-06-16  A00Z      cat2
  5      A8_A081      A8  2010-06-16  A00Z      cat2
  6      AO_A03L      AO  2010-08-11  A056      cat3
  7      AO_A0JE      AO  2010-08-11  A056      cat3
  8      A2_A0CX      A2  2010-07-14  A034      cat4
  .        .           .      .        .          .
  .        .           .      .        .          .
  .        .           .      .        .          .
  </code></pre>
  <p>I need to prepare a subset in that I had just rows with &quot;Cat&quot; values of more than one frequency. As a result, I need to have a subset as below:</p>
  <pre><code>No.       Id         X     Y         Z        Cat
  2      A8_A076      A8  2010-06-16  A00Z      cat2
  3      A8_A07B      A8  2010-06-16  A00Z      cat2
  4      A8_A07I      A8  2010-06-16  A00Z      cat2
  5      A8_A081      A8  2010-06-16  A00Z      cat2
  6      AO_A03L      AO  2010-08-11  A056      cat3
  7      AO_A0JE      AO  2010-08-11  A056      cat3
  .        .           .      .        .          .
  .        .           .      .        .          .
  .        .           .      .        .          .
  </code></pre>
  <p>How can I prepare that subset from my_data?
  And after getting the subset, I want to label the remaining Cat values based on the number from 1 same as below:</p>
  <pre><code>No.       Id         X     Y         Z        Cat
  2      A8_A076      A8  2010-06-16  A00Z       1
  3      A8_A07B      A8  2010-06-16  A00Z       1
  4      A8_A07I      A8  2010-06-16  A00Z       1
  5      A8_A081      A8  2010-06-16  A00Z       1
  6      AO_A03L      AO  2010-08-11  A056       2
  7      AO_A0JE      AO  2010-08-11  A056       2
  .        .           .      .        .          .
  .        .           .      .        .          .
  .        .           .      .        .          .
  </code></pre>