R编程排序,然后提取值

R编程排序,然后提取值,r,R,我想提取最后一天服用哪种抗生素的数值 i、 e.第8、14、16、18、20行中的抗生素名称请使您的代码更易于访问。如果您提供了数据,这会有所帮助。这可能会有帮助:或者: > head(ordereddf,20) patient_id day_given antibiotic_type route 1: 1 2 ciprofloxacin IV 2: 1 4 ciprofloxacin IV

我想提取最后一天服用哪种抗生素的数值
i、 e.第8、14、16、18、20行中的抗生素名称

请使您的代码更易于访问。如果您提供了数据,这会有所帮助。这可能会有帮助:或者:
> 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