Help with basic subsetting

Hello!

I am new to programming and need some help with basic subsetting in R. Hoping someone is willing to help as an easy summer challenge!

Dataset:

127 000 successful & unsuccesful acquisition bids in the US, 01/01/80 - 31/12/20 (see attached file).

Variables:

  • Bid announcement date
  • Bid completion date (if successful)
  • Deal status
  • Target ID
  • Acquirer ID
  • % acquired
  • % sought
  • Competing bid flag (YES/NO) - mostly blank observations
  • Divestiture flag (YES/NO)

I want to subset the dataset into two samples:

  1. Single bidder sample (no competing bids)
  2. Competition sample (two or more bidders)

The competition sample is defined by two possible scenarios:

1. Exactly two bids

  • 2 bids announced for the same target + 1 bid completed with at least 50% acquired = competition
  • 2 bids completed + 1 bid acquires at least 50% +
    • Competing bid flag = YES, or
    • Announcement dates <= 12 months apart + bid 1 is not completed before bid 2 is announced + divestiture = NO
      = competition

2. Multiple bids

  • 2+ bids announced for the same target + 1 bid completed with at least 50% acquired = competition
  • 2+ bids completed + 1 bid acquires at least 50% +
    • Competing bid flag = YES, or
    • No bid is completed before other bids are announced + divestiture flag = NO
      = competition

Thanks a lot!

Screenshot of dataset:

Welcome to the forum

I think you have given us a pretty clear exposition of the problem but dealing with it would be much easier with some sample data. For all sorts of reasons a screenshot of the data is not very useful.

A handy way to supply sample data is to use the dput() function. See ?dput. At a quick guess something like head(dput(myfile), 400) will likely supply enough data for us to work with. That's a bit more than I would normally suggest but it looks like you have a lot of conditions in there.

For some useful information on generally asking questions and general formatting I'd suggest having a look at FAQ: How to do a minimal reproducible example ( reprex ) for beginners

1 Like

Here is a dput of the first 270 observations. The forum wouldn't let me post more characters.

Obs    DATE_ANNOUNCED DATE_COMPLETED    STATUS TARGET_ID ACQUIROR_ID PCT_SOUGHT PCT_ACQUIRED DIVESTITURE COMPETITION
1       08/01/1980     12/12/1982 Completed    606191      907818          -        100.0          No            
2       21/01/1980     21/01/1980 Completed    719430      532457          -        100.0          No            
3       26/02/1980     30/03/1980 Completed    361109      482584          -        100.0          No            
4       28/02/1980     16/06/1980 Completed    902434      235811          -        100.0          No            
5       10/03/1980     05/08/1981 Completed     67149      716451          -        100.0          No            
6       26/03/1980                Withdrawn    364424      832110          -            -          No            
7       11/04/1980     31/01/1981 Completed    753329      490890       32.1        100.0          No            
8       13/04/1980     08/09/1981 Completed    761292      300864          -        100.0          No            
9       14/04/1980     30/01/1981 Completed    01726V       17266       35.0        100.0          No            
10      23/04/1980     02/01/1981 Completed    370472      235811        0.7        100.0          No            
11      30/04/1980     07/01/1981 Completed    752093        9730          -        100.0          No            
12      15/05/1980                Withdrawn    843571      802020          -            -          No            
13      30/05/1980     19/08/1980 Completed    12706Z      456866          -        100.0         Yes            
14      30/05/1980                Withdrawn    317495      391442          -        100.0          No            
15      02/06/1980     25/03/1982 Completed    655694      843673          -        100.0          No            
16      13/06/1980     02/10/1981 Completed    665751      318501          -        100.0          No            
17      17/06/1980     02/01/1981 Completed    308442      337477          -        100.0          No            
18      07/07/1980     30/03/1981 Completed    361765      707271          -        100.0          No            
19      14/07/1980     31/03/1981 Completed    628443      300864          -        100.0          No            
20      16/07/1980     01/04/1982 Completed     85581      651192       41.2        100.0          No            
21      08/08/1980     09/11/1980 Completed    804617      477196          -        100.0          No            
22      11/08/1980     06/10/1980 Completed    58039W      832110          -        100.0         Yes            
23      12/08/1980     01/05/1981 Completed    846829       66372          -        100.0          No            
24      13/08/1980     09/01/1984 Completed    338360      81949M          -        100.0         Yes            
25      18/08/1980                Withdrawn    694792      667446          -            -          No            
26      20/08/1980     02/02/1981 Completed    644239       30177       86.0        100.0          No            
27      20/08/1980     22/12/1980 Completed    694665       30177       89.4        100.0          No            
28      21/08/1980     21/01/1981 Completed    637734      629381       78.0        100.0          No            
29      24/08/1980     30/11/1980 Completed    745791      962898          -        100.0          No            
30      29/08/1980                Withdrawn    210795      951586          -        100.0          No            
31      04/09/1980     05/02/1981 Completed    460700      369604          -        100.0          No            
32      04/09/1980     24/12/1980 Completed    499598      848861          -        100.0          No            
33      10/09/1980     28/05/1981 Completed    571154      50025Q          -        100.0          No            
34      12/09/1980     01/10/1981 Completed    203836      841338          -        100.0          No            
35      12/09/1980                Withdrawn    227813      460575          -            -          No            
36      15/09/1980     23/10/1980 Completed     30141      698822          -        100.0          No            
37      18/09/1980     26/01/1981 Completed    565010      806857          -        100.0          No            
38      19/09/1980     25/03/1981 Completed    586448      962166          -        100.0          No            
39      20/09/1980     11/02/1981 Completed    893341      57129V          -        100.0          No            
40      22/09/1980     02/06/1981 Completed     43413       43413          -         20.6          No            
41      22/09/1980     11/12/1981 Completed    593099      50025Q          -        100.0          No            
42      22/09/1980                Withdrawn    827674      828301       12.6         12.6          No            
43      22/09/1980     01/05/1982 Completed    849441      760820          -        100.0          No            
44      23/09/1980     31/08/1981 Completed    760643      632593          -        100.0          No            
45      25/09/1980     11/01/1981 Completed    540417        1011          -        100.0          No            
46      01/10/1980     14/07/1981 Completed    715365      320644          -        100.0          No            
47      02/10/1980     24/03/1981 Completed    820276      427214        0.0        100.0          No            
48      08/10/1980     13/03/1981 Completed    854412      579780       11.5        100.0          No            
49      10/10/1980     30/04/1981 Completed      2280      754586        7.6        100.0          No            
50      13/10/1980     15/01/1981 Completed     32087      826622        1.0        100.0          No            
51      15/10/1980     18/08/1981 Completed    879488      96038M       29.7        100.0          No            
52      21/10/1980     22/05/1981 Completed    149645      216705       35.7        100.0          No            
53      21/10/1980     30/12/1980 Completed    231561      489314          -         25.0          No            
54      25/10/1980     01/07/1981 Completed    710456      337477          -        100.0          No            
55      27/10/1980     30/01/1981 Completed    231147      12501Q       32.6        100.0          No            
56      28/10/1980     19/08/1981 Completed     97880      05591M       67.0        100.0          No            
57      28/10/1980     01/11/1981 Completed    334100      882315       23.3        100.0          No            
58      28/10/1980                Withdrawn    83265Q      441812          -            -          No            
59      01/11/1980     10/03/1981 Completed    763172      81949M          -        100.0         Yes            
60      09/11/1980     31/03/1981 Completed     30270      491189       36.0        100.0          No            
61      12/11/1980     10/03/1981 Completed    801047      855277          -        100.0          No            
62      13/11/1980     27/02/1981 Completed    458101       44540          -        100.0          No            
63      13/11/1980     16/07/1981 Completed    911364      615318       23.0        100.0          No            
64      17/11/1980     11/09/1981 Completed    318668      318687          -        100.0          No            
65      20/11/1980     01/07/1981 Completed    633483      318396          -        100.0          No            
66      21/11/1980                Withdrawn    231561      489314          -            -          No            
67      24/11/1980     06/04/1981 Completed     26051      535512       33.6        100.0          No            
68      24/11/1980     25/09/1981 Completed    191162      191216          -        100.0          No            
69      24/11/1980     27/08/1981 Completed    191162      191098        9.2        100.0          No            
70      25/11/1980     29/04/1981 Completed    227813      216669       41.0        100.0          No            
71      25/11/1980     02/01/1981 Completed    929501      48262L       27.0        100.0          No            
72      26/11/1980     31/08/1981 Completed    165231      532172        2.5         64.5          No            
73      26/11/1980     23/01/1981 Completed    929501      486872          -        100.0          No            
74      01/12/1980     27/04/1981 Completed    442281      880370          -        100.0          No            
75      01/12/1980     13/05/1981 Completed    806228      86331X       60.3        100.0          No            
76      03/12/1980     10/06/1981 Completed    829710      410522       72.6        100.0          No            
77      04/12/1980     11/08/1981 Completed    114718         361       26.8        100.0          No            
78      04/12/1980     01/04/1981 Completed    497656      216669        5.0        100.0          No            
79      05/12/1980     20/02/1981 Completed    847507      847507          -            -          No            
80      08/12/1980     14/04/1981 Completed    644171      263534          -        100.0          No            
81      09/12/1980     24/04/1981 Completed    442281      880370          -        100.0          No            
82      10/12/1980     04/09/1981 Completed    194720      882147          -        100.0          No            
83      10/12/1980     26/02/1981 Completed    911358      21789Q       37.6        100.0          No            
84      13/12/1980     07/04/1981 Completed    356715      582445          -        100.0          No            
85      13/12/1980     18/02/1982 Completed    553393      612171       51.7        100.0          No            
86      16/12/1980     01/11/1981 Completed    324279      337358          -        100.0          No            
87      17/12/1980     18/12/1980 Completed     95690      370856          -        100.0          No            
88      19/12/1980     06/02/1981 Completed    746030      746030          -         19.0          No            
89      22/12/1980     31/12/1981 Completed    336789       68055          -        100.0          No            
90      23/12/1980     21/06/1981 Completed    480034      502210          -        100.0          No            
91      02/01/1981     15/04/1981 Completed    119529       32037        3.4        100.0          No            
92      02/01/1981     30/01/1981 Completed    231561      231561          -         12.0          No            
93      02/01/1981     23/04/1982 Completed    599700       61790          -        100.0          No            
94      02/01/1981     02/01/1981 Completed    63039P      883556          -        100.0          No            
95      05/01/1981     06/01/1981 Completed    575617      294510          -        100.0          No            
96      06/01/1981                Withdrawn    754586      428399          -        100.0          No            
97      08/01/1981                Withdrawn    56516D      237688          -        100.0          No            
98      09/01/1981     10/02/1981 Completed    881552       55345          -        100.0          No            
99      10/01/1981     10/01/1981 Completed    461035      843456          -        100.0          No            
100     12/01/1981     22/01/1981 Completed     42591      125655          -        100.0          No            
101     12/01/1981     12/01/1981 Completed    972254      502210          -        100.0          No            
102     13/01/1981     15/03/1981 Completed    374279      383492          -        100.0          No            
103     15/01/1981                Withdrawn    420170      252468          -        100.0          No            
104     15/01/1981     15/01/1981 Completed    834921        2455          -        100.0          No            
105     15/01/1981     30/03/1981 Completed    988858      688260          -        100.0          No            
106     16/01/1981     11/08/1981 Completed    501215      931142          -        100.0          No            
107     16/01/1981     27/04/1981 Completed    750089      443510          -        100.0         Yes            
108     16/01/1981     28/10/1981 Completed    84836W       58319       75.0        100.0          No            
109     19/01/1981     01/10/1981 Completed    344570      882147          -        100.0          No            
110     20/01/1981     23/01/1981 Completed    927770      150843          -        100.0          No            
111     21/01/1981     28/08/1981 Completed      7509      727346          -        100.0          No            
112     21/01/1981     04/07/1981 Completed     53287      278749          -        100.0         Yes            
113     21/01/1981     21/01/1981 Completed     59075      125655          -        100.0          No            
114     21/01/1981     14/07/1981 Completed    09973V      278749          -        100.0         Yes            
115     21/01/1981     17/02/1981 Completed    296470      296470          -          5.9          No            
116     23/01/1981     26/03/1981 Completed      2030      402064       84.0        100.0          No            
117     24/01/1981     27/05/1981 Completed    128703       45573          -        100.0          No            
118     26/01/1981     06/06/1981 Completed    395736      320545          -        100.0          No            
119     26/01/1981     13/03/1981 Completed    415864      224399        4.3         20.2          No            
120     26/01/1981     18/08/1981 Completed    56405Q      844769          -        100.0          No            
121     26/01/1981     22/07/1981 Completed    681104        7239          -        100.0          No            
122     27/01/1981     28/05/1981 Completed    262188      389280          -        100.0          No            
123     27/01/1981     01/10/1981 Completed    318405      913164          -        100.0          No            
124     28/01/1981     30/09/1981 Completed    102103      783549          -        100.0          No            
125     28/01/1981     30/06/1981 Completed    203480      709789          -        100.0          No            
126     28/01/1981     28/01/1981 Completed    258363      489207          -        100.0         Yes          No
127     29/01/1981     24/02/1981 Completed     81689       81689          -         17.0          No            
128     29/01/1981     02/07/1981 Completed    126858      139861          -        100.0          No            
129     30/01/1981     06/07/1981 Completed     69203      237038       56.5        100.0          No            
130     30/01/1981     01/05/1981 Completed    806517      806517          -            -          No            
131     30/01/1981     30/01/1981 Completed    892770      638760          -        100.0          No            
132     31/01/1981     13/04/1981 Completed    367622      367622          -         41.8          No            
133     02/02/1981                Withdrawn     95293       16900          -            -          No            
134     02/02/1981     05/05/1981 Completed    577896      369856          -        100.0          No            
135     02/02/1981     05/05/1981 Completed    577896      369856          -        100.0          No            
136     03/02/1981     04/05/1981 Completed     29681      147448       23.6        100.0          No            
137     03/02/1981     30/03/1981 Completed    830661      761338          -        100.0         Yes            
138     05/02/1981     16/04/1982 Completed    301574      301574       53.0         53.0          No            
139     06/02/1981     06/02/1981 Completed    411631      934436          -          8.6          No            
140     09/02/1981                Withdrawn    119529      676345          -        100.0          No            
141     09/02/1981     28/10/1982 Completed    210795      882525          -        100.0          No            
142     10/02/1981     10/04/1981 Completed     16230       16230          -          2.7          No            
143     13/02/1981     25/09/1981 Completed    10058Q      820901          -        100.0          No            
144     13/02/1981     17/03/1981 Completed    811080      968604       56.5        100.0          No            
145     13/02/1981     29/06/1981 Completed    932355      441811          -        100.0          No            
146     16/02/1981     01/07/1981 Completed    217210      43162T       36.0        100.0          No            
147     16/02/1981     05/05/1981 Completed    433728      23326E          -        100.0          No            
148     16/02/1981                Withdrawn    831538      343465          -        100.0          No            
149     16/02/1981     16/02/1981 Completed    881181      337410          -        100.0          No            
150     17/02/1981     04/06/1981 Completed    693150      361556          -        100.0          No            
151     17/02/1981     29/06/1981 Completed    932355      441812          -        100.0          No            
152     18/02/1981     29/04/1981 Completed    433728      237410          -        100.0         Yes            
153     18/02/1981     18/06/1981 Completed    867876      922231       50.4        100.0          No            
154     20/02/1981                Withdrawn    19730Q      46145M          -            -          No            
155     20/02/1981     30/09/1981 Completed    203615      857120          -        100.0          No            
156     23/02/1981     01/10/1981 Completed    320812      820480          -        100.0          No            
157     23/02/1981     14/05/1981 Completed    361765      707271          -        100.0          No            
158     23/02/1981     12/06/1981 Completed    901221      81949M          -        100.0         Yes            
159     24/02/1981     24/02/1981 Completed    842571      739732          -        100.0          No            
160     25/02/1981     25/02/1981 Completed    912080      178872          -        100.0          No            
161     26/02/1981     13/05/1981 Completed    268714      941063          -        100.0          No            
162     27/02/1981     24/03/1981 Completed    191098      191098          -         11.6          No            
163     01/03/1981     02/09/1981 Completed    10890M      892059          -        100.0          No            
164     03/03/1981     08/05/1981 Completed    02663Q      278764          -        100.0          No            
165     03/03/1981     15/04/1981 Completed     99467       99467          -            -          No            
166     04/03/1981     30/04/1981 Completed    320175      320175          -         10.5          No            
167     04/03/1981                Withdrawn    967613      246136          -            -          No            
168     06/03/1981     02/04/1981 Completed     21375       21375          -          8.0          No            
169     06/03/1981                Withdrawn     23127      853683          -        100.0          No            
170     06/03/1981     15/09/1981 Completed    335829      193252          -        100.0          No            
171     09/03/1981                Withdrawn    114720      404256          -            -          No            
172     09/03/1981                Withdrawn    884842      761525          -        100.0          No            
173     10/03/1981                Withdrawn    790155      466119        1.0          1.0          No            
174     10/03/1981     02/06/1981 Completed    964882      370514          -        100.0          No            
175     10/03/1981     03/05/1982 Completed    981143      820480          -        100.0          No            
176     12/03/1981     05/05/1981 Completed    489207      853734          -        100.0         Yes            
177     12/03/1981     04/06/1981 Completed    489314      853734          -        100.0          No            
178     12/03/1981     24/12/1981 Completed    510053      319594          -        100.0          No            
179     13/03/1981     17/08/1981 Completed    441767      57069Z          -        100.0          No            
180     13/03/1981     13/03/1981 Completed    513279      369604          -        100.0          No            
181     16/03/1981     02/07/1981 Completed     20051      296659          -        100.0          No            
182     16/03/1981     14/04/1981 Completed    03822M      922272          -        100.0          No            
183     16/03/1981     31/07/1981 Completed    488395      402237          -        100.0         Yes            
184     16/03/1981     16/03/1981 Completed    488395      402460          -        100.0          No            
185     16/03/1981     22/04/1981 Completed    848361      629156          -        100.0          No            
186     17/03/1981     23/04/1981 Completed    03790X       42476          -        100.0          No            
187     18/03/1981     08/05/1981 Completed    460147      448499          -        100.0         Yes            
188     18/03/1981     29/01/1983 Completed    577038      416655          -        100.0          No            
189     19/03/1981     12/06/1981 Completed     56357      744350          -        100.0          No            
190     19/03/1981     19/03/1981 Completed    309478      882147          -        100.0          No            
191     19/03/1981     30/04/1981 Completed    372463      236235          -        100.0          No            
192     19/03/1981                Withdrawn    828879      302622          -        100.0          No            
193     20/03/1981     20/03/1981 Completed    62402Q      236235          -        100.0          No            
194     20/03/1981     18/12/1981 Completed    883050      254674          -        100.0          No            
195     23/03/1981     12/02/1982 Completed    448582       32790       95.0        100.0          No            
196     23/03/1981     07/12/1981 Completed    686266      221399          -        100.0          No            
197     25/03/1981                Withdrawn    422893      17303M          -        100.0          No            
198     26/03/1981     03/12/1981 Completed     66275        8677          -        100.0         Yes            
199     26/03/1981     26/03/1981 Completed    691207      159420          -        100.0          No            
200     27/03/1981     03/12/1981 Completed     66275        8677          -        100.0          No            
201     27/03/1981                Withdrawn    205826      00777Z          -        100.0          No            
202     27/03/1981     23/04/1982 Completed    559194      629060        7.5        100.0          No            
203     27/03/1981     22/07/1981 Completed    588621      615318          -        100.0          No            
204     30/03/1981     01/10/1981 Completed    174120      695262          -        100.0          No            
205     30/03/1981                Withdrawn    751874      543859          -        100.0          No            
206     31/03/1981     27/07/1981 Completed     42393      814831          -        100.0          No            
207     31/03/1981     03/08/1981 Completed    790155      34385E          -        100.0          No            
208     01/04/1981     24/04/1982 Completed    44041I      879284          -         83.0          No            
209     02/04/1981     15/05/1981 Completed      9086        9272          -        100.0          No            
210     02/04/1981                Withdrawn     42681      590213          -        100.0          No            
211     02/04/1981     04/05/1981 Completed    313081      302380          -        100.0          No            
212     02/04/1981     17/04/1981 Completed    88319A      67035T          -        100.0         Yes            
213     03/04/1981     27/10/1981 Completed    211515      531090          -        100.0          No            
214     03/04/1981     31/03/1982 Completed    374254      587541          -        100.0          No            
215     05/04/1981     30/06/1981 Completed    114720       27429        2.3        100.0          No            
216     06/04/1981                Withdrawn    294441      502445          -            -          No            
217     07/04/1981     24/06/1981 Completed    170394       31897          -        100.0          No            
218     08/04/1981     14/08/1981 Completed    339420      892348          -        100.0          No            
219     08/04/1981     08/04/1981 Completed    882213      844769          -        100.0          No            
220     09/04/1981     22/05/1981 Completed     77097       77097          -         38.4          No            
221     09/04/1981     14/07/1981 Completed    156447      156540          -        100.0          No            
222     09/04/1981                Withdrawn    653471      390064          -        100.0          No            
223     10/04/1981                Withdrawn    255696      977869          -        100.0          No            
224     10/04/1981     10/07/1981 Completed    759523      902182          -        100.0          No            
225     14/04/1981                Withdrawn    902541      909408       27.6         27.6          No            
226     15/04/1981     12/11/1981 Completed     61613      841338          -        100.0          No            
227     15/04/1981                Withdrawn    740529      00777Z          -        100.0          No            
228     16/04/1981     20/05/1982 Completed     18573      341018          -        100.0          No            
229     16/04/1981     28/12/1981 Completed    322135      337358          -        100.0          No            
230     17/04/1981     15/05/1981 Completed    683574      878415       14.4         28.9          No            
231     18/04/1981     30/06/1983 Completed    100473      40187Q          -        100.0          No            
232     20/04/1981     29/06/1981 Completed    82193R       25816          -        100.0          No            
233     21/04/1981     26/08/1981 Completed    441061      441065          -        100.0         Yes            
234     21/04/1981     30/06/1981 Completed    717116      463349          -        100.0          No            
235     22/04/1981     07/09/1981 Completed    174721      454002          -        100.0          No            
236     22/04/1981     04/01/1982 Completed    333514      33841Z       29.8        100.0          No            
237     22/04/1981     07/05/1981 Completed    379554      753228          -        100.0          No            
238     23/04/1981     03/01/1982 Completed    538024       18870          -        100.0          No            
239     23/04/1981     06/07/1981 Completed    629527      853139          -        100.0          No            
240     23/04/1981     01/02/1982 Completed    682590      909527          -        100.0          No            
241     24/04/1981     09/12/1981 Completed    853037      931159       58.0        100.0          No            
242     27/04/1981     27/04/1981 Completed    151347       81721          -        100.0          No            
243     27/04/1981     01/06/1981 Completed    314370      440408          -        100.0          No            
244     27/04/1981                Withdrawn    338027      966680          -        100.0          No            
245     27/04/1981                Withdrawn    632380      857473          -        100.0          No            
246     27/04/1981                Withdrawn    793897      793898        5.0        100.0          No            
247     27/04/1981     10/02/1982 Completed    922305      57685W          -        100.0          No            
248     28/04/1981     28/04/1981 Completed    00279P       26681          -        100.0          No            
249     28/04/1981     30/05/1981 Completed    844432      319779          -          8.9          No            
250     29/04/1981     29/04/1981 Completed    412333      578592          -        100.0          No            
251     29/04/1981     29/04/1981 Completed    560334      587541          -        100.0          No            
252     29/04/1981     18/12/1981 Completed    577377      501860          -        100.0          No            
253     29/04/1981                Withdrawn    844775      587541          -        100.0          No            
254     30/04/1981     01/04/1982 Completed     61743      337477          -        100.0          No            
255     30/04/1981     30/04/1981 Completed    292890      70202L          -        100.0          No            
256     30/04/1981     03/06/1981 Completed    351680      886419          -        100.0         Yes            
257     30/04/1981     30/04/1981 Completed    488412      783502          -        100.0          No            
258     30/04/1981                Withdrawn    547779       19087          -        100.0          No            
259     30/04/1981     18/09/1981 Completed    56516D      913025          -        100.0          No            
260     30/04/1981     01/04/1982 Completed    710530      587405          -        100.0          No            
261     30/04/1981     22/05/1981 Completed    913353      913353          -         12.4          No            
262     01/05/1981     01/05/1984 Completed    06538Q      19549H          -        100.0          No            
263     01/05/1981                Withdrawn    515506      683790          -        100.0          No            
264     01/05/1981     01/05/1981 Completed    901486      585263          -        100.0          No            
265     06/05/1981     06/08/1981 Completed     69599       29362          -        100.0          No            
266     06/05/1981     15/03/1983 Completed    175056       18870          -        100.0          No            
267     06/05/1981     05/06/1981 Completed    974280      974280          -          5.8          No            
268     07/05/1981     22/12/1981 Completed    26579E      541381          -        100.0          No            
269     08/05/1981     01/03/1982 Completed     37710      62844L       75.0        100.0          No            
270     08/05/1981     15/09/1981 Completed    144501      255381          -        100.0          No            
>

I think I was able to sort the "2 bids announced for same target"-point using:

potential.comp <- df[with(df, TARGET_ID %in% names(which(table(TARGET_ID)>=2))), ]

The following 130 observations:

Obs    DATE_ANNOUNCED DATE_COMPLETED    STATUS TARGET_ID ACQUIROR_ID PCT_SOUGHT PCT_ACQUIRED DIVESTITURE COMPETITION
271     08/05/1981     08/05/1981 Completed    39154Q      45764Z          -         78.0          No            
272     11/05/1981     31/07/1981 Completed    120655       19087          -        100.0          No            
273     11/05/1981     31/07/1981 Completed    120655       19087          -        100.0          No            
274     11/05/1981     11/12/1981 Completed    694055      865593          -        100.0          No            
275     11/05/1981     11/05/1981 Completed    921033      921033          -         10.7          No            
276     12/05/1981     05/11/1981 Completed     96887      319284          -        100.0          No            
277     12/05/1981     04/01/1983 Completed    32079C      841338          -        100.0          No            
278     12/05/1981                Withdrawn    746252      296470          -        100.0          No            
279     13/05/1981     31/07/1981 Completed    402064      402064          -        100.0          No            
280     13/05/1981     12/06/1981 Completed    506537      454192          -        100.0          No            
281     14/05/1981     31/12/1981 Completed    143880      628855          -        100.0          No            
282     14/05/1981     01/07/1982 Completed    156436      866635          -        100.0          No            
283     14/05/1981     30/11/1981 Completed    461565      461562       38.0        100.0          No            
284     15/05/1981                Withdrawn    07028Q       67374          -        100.0          No            
285     15/05/1981     29/01/1982 Completed    328003       18870          -        100.0          No            
286     15/05/1981     15/05/1981 Completed    560381      40187Q          -        100.0         Yes            
287     19/05/1981     17/11/1981 Completed    902541      46145M          -         72.4          No            
288     19/05/1981     19/11/1981 Completed    902541      90939Z       38.0        100.0          No            
289     19/05/1981     02/07/1981 Completed    917330      804016          -        100.0          No            
290     20/05/1981                Withdrawn    680895      805176          -        100.0          No            
291     21/05/1981     22/10/1981 Completed     31205      252741          -        100.0          No            
292     21/05/1981     21/05/1981 Completed    190910       38222          -        100.0         Yes            
293     21/05/1981     01/09/1981 Completed    521685      151295          -        100.0          No            
294     21/05/1981     28/07/1981 Completed    909381      591605          -        100.0          No            
295     22/05/1981     01/07/1981 Completed    319108      251457          -        100.0          No            
296     22/05/1981     25/09/1981 Completed    481520       23735          -        100.0          No            
297     27/05/1981     27/05/1981 Completed    595140        6356          -        100.0          No            
298     27/05/1981     03/06/1981 Completed    981556      369514          -        100.0          No            
299     28/05/1981     11/09/1981 Completed    262246      793453          -        100.0          No            
300     28/05/1981     28/05/1981 Completed    292666      374280          -        100.0         Yes            
301     28/05/1981     28/05/1981 Completed    929226      139861          -        100.0         Yes            
302     01/06/1981     03/07/1981 Completed    335558      335558          -          2.6          No            
303     01/06/1981     12/08/1981 Completed    462277      674599          -        100.0          No            
304     02/06/1981     02/06/1981 Completed    670540       57741          -        100.0          No            
305     03/06/1981     18/08/1981 Completed     31527      484170          -        100.0          No            
306     03/06/1981     14/08/1981 Completed     53494       53494          -        100.0          No            
307     03/06/1981     14/07/1981 Completed     82079      814132          -        100.0          No            
308     03/06/1981     03/06/1981 Completed    48837A      484170          -        100.0          No            
309     03/06/1981     15/07/1981 Completed    922573      390568          -        100.0         Yes            
310     04/06/1981                Withdrawn    668078      307670        0.1          0.1          No            
311     04/06/1981                Withdrawn    882214      236235          -        100.0          No            
312     05/06/1981     05/06/1981 Completed    313693      313693          -         20.0          No            
313     05/06/1981     24/09/1981 Completed    460627      950590          -        100.0          No            
314     05/06/1981     05/06/1981 Completed    707448      760478          -        100.0         Yes            
315     08/06/1981     28/12/1981 Completed    784015      784015          -            -          No            
316     09/06/1981                Withdrawn    203172      207315          -        100.0          No            
317     09/06/1981     09/06/1981 Completed    390154      191144          -        100.0          No            
318     10/06/1981     30/09/1981 Completed     52187      320545          -        100.0          No            
319     10/06/1981     05/05/1982 Completed    358478      869810          -        100.0          No            
320     10/06/1981     31/12/1981 Completed    367570      668087          -        100.0          No            
321     10/06/1981     10/06/1981 Completed    561671      212093        9.1         14.5          No            
322     10/06/1981     14/09/1982 Completed    588415      587541          -        100.0          No            
323     10/06/1981     15/08/1981 Completed    679061      171900       50.5        100.0          No            
324     10/06/1981     10/06/1981 Completed    844447      844447          -          6.7          No            
325     11/06/1981     15/12/1981 Completed     82647       26681          -        100.0          No            
326     11/06/1981     11/06/1981 Completed    192340      670349          -        100.0          No            
327     11/06/1981     03/12/1981 Completed    681142      292740          -        100.0          No            
328     11/06/1981     09/07/1981 Completed    91994M      452722          -        100.0          No            
329     12/06/1981     27/08/1981 Completed    236289      676346       26.5        100.0          No            
330     12/06/1981     20/07/1981 Completed    413090      44714R          -        100.0          No            
331     12/06/1981     12/06/1981 Completed    547575      195676          -        100.0          No            
332     15/06/1981     05/10/1981 Completed    453730      105135          -        100.0          No            
333     16/06/1981     24/06/1981 Completed    70467V      561699          -        100.0          No            
334     16/06/1981                Withdrawn    737384      05583R          -        100.0          No            
335     16/06/1981     19/03/1982 Completed    929773      680293          -        100.0          No            
336     17/06/1981     31/07/1981 Completed    144276       13788          -        100.0          No            
337     17/06/1981     07/08/1981 Completed    167826      168232          -         81.0          No            
338     17/06/1981     29/03/1982 Completed    336045      844769          -        100.0          No            
339     17/06/1981     07/07/1981 Completed    412821      412801          -        100.0         Yes            
340     17/06/1981     29/03/1982 Completed    760762      844769          -        100.0          No            
341     17/06/1981     31/08/1981 Completed    894546      303261       34.0        100.0          No            
342     18/06/1981     18/06/1981 Completed     90042      670349          -        100.0          No            
343     18/06/1981     31/03/1982 Completed    320790       68055          -        100.0          No            
344     18/06/1981     18/06/1981 Completed    593099      549714          -        100.0          No            
345     18/06/1981     18/06/1981 Completed    677865      383883          -        100.0          No            
346     18/06/1981     10/07/1981 Completed    776678      776678          -         14.0          No            
347     18/06/1981     31/08/1981 Completed    828658      828658          -         18.1          No            
348     18/06/1981     18/06/1981 Completed    877173      670349          -        100.0          No            
349     19/06/1981     01/10/1981 Completed    20033R      189054          -        100.0          No            
350     19/06/1981                Withdrawn    208251      811845        0.2         51.8          No            
351     19/06/1981     28/10/1981 Completed    554307      14225T       26.5        100.0          No            
352     19/06/1981     30/11/1981 Completed    743834      743834          -          3.6          No            
353     20/06/1981     01/10/1981 Completed    910562       26874       25.0        100.0          No            
354     22/06/1981     18/10/1983 Completed    337547      587541          -        100.0          No            
355     22/06/1981     01/10/1981 Completed    910562       26874          -         75.0          No            
356     23/06/1981     15/09/1981 Completed    254660      302846          -        100.0          No            
357     23/06/1981                Withdrawn    340018      628855          -        100.0          No            
358     23/06/1981     05/08/1982 Completed    357685      302421       61.4        100.0          No            
359     23/06/1981     04/01/1982 Completed    370514      13480T          -        100.0          No            
360     23/06/1981     04/08/1981 Completed    910516      816068          -        100.0         Yes            
361     24/06/1981     31/03/1982 Completed    327550       18870          -        100.0          No            
362     24/06/1981     31/12/1981 Completed    36142H      00251C          -        100.0         Yes            
363     24/06/1981     24/12/1981 Completed    486620      486620          -         21.3          No            
364     24/06/1981     03/05/1982 Completed    912320      229899          -        100.0          No            
365     25/06/1981     22/12/1982 Completed    159591       59438          -        100.0          No            
366     26/06/1981                Withdrawn    03801M      852206          -        100.0          No            
367     26/06/1981     10/08/1981 Completed    167772      167772          -        100.0          No            
368     29/06/1981     28/08/1981 Completed     37619       19087          -        100.0          No            
369     30/06/1981     30/06/1981 Completed    13124M      369604          -        100.0          No            
370     30/06/1981                Withdrawn    333549      760281          -        100.0          No            
371     01/07/1981                Withdrawn    730196      896755          -        100.0          No            
372     01/07/1981     01/07/1981 Completed    76161K      559108          -        100.0          No            
373     02/07/1981     25/08/1981 Completed    28359A      364730          -        100.0          No            
374     02/07/1981     10/05/1982 Completed    310640      587534          -        100.0          No            
375     02/07/1981     31/03/1982 Completed    322388       18870          -        100.0          No            
376     02/07/1981                Withdrawn    690105      198270          -        100.0          No            
377     02/07/1981     23/07/1981 Completed    902112      561263          -        100.0          No            
378     06/07/1981     30/09/1981 Completed    208251      263534          -        100.0          No            
379     06/07/1981     01/02/1982 Completed    329009      318900          -        100.0          No            
380     06/07/1981     30/11/1981 Completed    505754       42170          -        100.0          No            
381     06/07/1981                Withdrawn    580347      444393          -        100.0          No            
382     06/07/1981     31/07/1981 Completed    961505       68055          -        100.0          No            
383     07/07/1981                Withdrawn    208251      881694          -            -          No            
384     07/07/1981     07/07/1981 Completed    413615      435081          -        100.0          No            
385     07/07/1981     07/07/1981 Completed    629354      458124          -        100.0         Yes            
386     07/07/1981     01/02/1982 Completed    957586        9114          -         12.6          No            
387     08/07/1981     27/08/1981 Completed    41740M      872649          -        100.0          No            
388     08/07/1981     14/07/1981 Completed    654150      261471          -        100.0         Yes            
389     08/07/1981                Withdrawn    757708      941063          -            -         Yes            
390     08/07/1981     04/08/1981 Completed    961292      703904          -         82.0          No            
391     09/07/1981     04/01/1982 Completed     97474      440506          -        100.0          No            
392     09/07/1981     30/10/1982 Completed    207633      416655          -        100.0          No            
393     09/07/1981     03/12/1981 Completed    383488      361449          -        100.0         Yes            
394     09/07/1981     15/01/1982 Completed    720285      720285          -        100.0          No            
395     09/07/1981     01/09/1981 Completed    784603      251457          -        100.0          No            
396     09/07/1981     09/07/1981 Completed    811302      205887          -        100.0          No            
397     09/07/1981                Withdrawn    828301      827674       20.9         20.9          No            
398     09/07/1981                Withdrawn    867816      827674        8.0          8.0          No            
399     09/07/1981     07/09/1981 Completed    883059      291210          -        100.0          No            
400     10/07/1981     10/07/1981 Completed    10079Q      235811          -        100.0         Yes            

Please try again, that is not the output of dput()

Example of dput()

 dput(head(iris, 10))
structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4, 4.6, 
5, 4.4, 4.9), Sepal.Width = c(3.5, 3, 3.2, 3.1, 3.6, 3.9, 3.4, 
3.4, 2.9, 3.1), Petal.Length = c(1.4, 1.4, 1.3, 1.5, 1.4, 1.7, 
1.4, 1.5, 1.4, 1.5), Petal.Width = c(0.2, 0.2, 0.2, 0.2, 0.2, 
0.4, 0.3, 0.2, 0.2, 0.1), Species = structure(c(1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L), .Label = c("setosa", "versicolor", "virginica"
), class = "factor")), row.names = c(NA, 10L), class = "data.frame")

Yeah, so the first thing is to read your data into R (maybe with the readxl and janitor package then to use the dput() as instructed so that someone can help you with the subsetting.

readxl: https://readxl.tidyverse.org/
janitor: The janitor package

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.