I have a dataframe with many thousands of rows. Every row is a hospitalization record; it contains the ID of the patient and a lot of health information (diagnosis, date of admission, date of dismissal, and so on).
Every patient can have more than a hospitalization record, but I need only the first hospitalization of every patient, e.g. the first record for each patient ID according to the date of admission. How can I get this result in R?
Thank you in advance.