I have a data frame where in the first column I have a Patient ID and in the second column I have a Date (date time) when a specific test was taken. The columns thereafter are columns of the specific tests (b, a, c, d). At the moment, for every Patient ID and every Date I have a row with the results of the specific test and NA in the columns of all other tests.
I want to collapse the data frame in a way that whenever Patient ID and Date match, the test results are collapsed into one row only.
I have tried aggregate(), collapse(), and group_by(), but did not manage to do this. The functions are only activated when Patient ID and Date match, not just one of the columns.

Data copied from picture:
Extract
Date(please specifytz(time zone)). You probably need to adaptformat. This step is needed due the bad data structure (I needed to copy the data from picture). Thenaggregate:gives
If you don't like the order, change it. E.g.
PatientIDin ascending order as the raw data (X) is organised: