Hello, I need assistance in cleaning up some data. The data in the table contain multiple IDs, dates, and categories. I am interested in IDs with category 1 and 2, or 1 and 2 and 3, or 1 and 3, while retaining only the entries with the maximum date for each category. Could you please provide the best script for this solution? Thank you!
| ID | category | date | costA | costB | costC | costD |
| 1 | 1 | 1/21/16 | 5000 | 0 | 3000 | 500 |
| 1 | 1 | 1/21/16 | 1000 | 5000 | 10000 | 0 |
| 1 | 1 | 1/21/16 | 20000 | 0 | 10 | 50 |
| 1 | 2 | 1/22/16 | 3000 | 0 | 0 | 50000 |
| 1 | 3 | 2/1/16 | 1 | 10 | 900 | 0 |
| 2 | 1 | 4/2/13 | 0 | 100 | 10000 | 5000 |
| 2 | 2 | 4/3/13 | 0 | 0 | 0 | 642.49 |
| 2 | 1 | 4/2/13 | 1 | 10 | 900 | 0 |
| 3 | 2 | 3/6/15 | 50 | 0 | 0 | 259.58 |