I have a dataset which contains three variables: CityA, CityB and Dstance. See the following example:
|
CityA |
CityB |
Distance |
| 1 |
New York |
Los Angeles |
2789 |
| 2 |
Chicago |
Houston |
1082 |
| 3 |
Las Vegas |
Los Angeles |
270 |
| 4 |
Los Angeles |
New York |
2789 |
However, there are 'duplications' for some (not all) pairs of cityA and cityB. As shown in the 1st and 4th row of the example above, there are two observarions about the distance between NY and LA. I just want to ask are there any simple ways to drop those duplicates?
Btw, since there are many city pairs that share the same distance in my dataset, so it is not convenient to sort by Distance then drop if _n != 1.
It looks like a simple question but it really took me a lot of time...
Many thanks in advance!
0 Response to Dropping duplicated pairs of two variables
Post a Comment