'Filter for non-repeated values based on Unique ID
I've the following table
| S/N | Unique ID | Code |
|---|---|---|
| 1 | 111 | YES |
| 2 | 111 | YES |
| 3 | 111 | NO |
| 4 | 111 | YES |
| 5 | 222 | YES |
| 6 | 222 | YES |
| 7 | 222 | YES |
| 8 | 222 | YES |
| 9 | 333 | NO |
| 10 | 333 | NO |
| 11 | 333 | YES |
| 12 | 333 | YES |
How do I derive the following table based on the following conditions: For each unique ID, if YES repeats, keep the first YES. If NO Appears, keep the following YES. I tried using mutate and it's giving me all sort of errors.
| S/N | Unique ID | Code |
|---|---|---|
| 1 | 111 | YES |
| 4 | 111 | YES |
| 5 | 222 | YES |
| 11 | 333 | YES |
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
