I have a data frame(data1) whose structure is:
   Time-period   income
   Jan.2000      15000
   Jan.2000      23000
   Jan.2000      17400
   Jan.2000      11111
         .         .
         .         .
   Feb.2000      37000
   Feb.2001      39000
   Mar.2001      39000
   Mar.2001      39000
         .           .
         .           .
Thus for each month and year there are nentries in the data frame data1. What I want is that for each month of each year there should be only atmost 2(top 2 if more than 2 are there) entries. Thus for Jan. 2000 I want to have only top 2 entries and remove rest of the entries from data frame data1. Similarly for every month of every year wherever there are more than two entries. How do I do that? 
UPDATE: Here is my sample data set:
   Time-period   income
   Jan.2000      15000
   Jan.2000      23000
   Jan.2000      17400
   Feb.2000      37000
   Feb.2000      39000
   Mar.2000      39000
   Mar.2000      39000
   Mar.2000      39500
   Jan.2000      11111
   Apr.2000      39000
After filtering I should get:
       Time-period   income
       Jan.2000      15000
       Jan.2000      23000
       Feb.2000      37000
       Feb.2000      39000
       Mar.2000      39000
       Mar.2000      39000
       Apr.2000      39000
Notice that how last 2 entries of Jan. 2000(one of which is after Mar. 2000 so time-period is not ordered) and last entry of Mar. 2000 got removed but for Feb. 2000 and Apr 2000 no deletion happened as there number of entries was <= 2       
 
     
    