> head(ordereddf,20)
patient_id day_given antibiotic_type route
1: 1 2 ciprofloxacin IV
2: 1 4 ciprofloxacin IV
3: 1 6 ciprofloxacin IV
4: 1 7 doxycycline IV
5: 1 9 doxycycline IV
6: 1 15 penicillin IV
7: 1 16 doxycycline IV
8: 1 18 ciprofloxacin IV
9: 8 1 doxycycline PO
10: 8 2 penicillin IV
11: 8 3 doxycycline IV
12: 8 6 doxycycline PO
13: 8 8 penicillin PO
14: 8 12 penicillin IV
15: 9 8 doxycycline IV
16: 9 12 doxycycline PO
17: 12 4 doxycycline PO
18: 12 9 doxycycline IV
19: 16 1 doxycycline IV
20: 16 4 amoxicillin IV
I want to extract values that last day which antibiotic was given i.e. antibiotic-name in rows 8,14,16,18,20