Как я могу преобразовать это:
patient_id test test_value date_taken
11964 HBA1C 8.60 2017-06-14
11964 Glucose 231.00 2017-05-01
11964 Glucose 202.00 2017-07-01
11964 Glucose 194.00 2017-09-02
11964 Creatinine 1.10 2017-05-01
11964 Creatinine 1.28 2017-08-14
к этому?
patient_id hba1c_earliest hba1c_latest hba1c_change glucose_earliest glucose_latest/
11964 8.60 8.60 0.0000 231.0 194.0
glucose_change creatinine_earliest creatinine_latest creatinine_change
-0.1602 1.10 1.28 0.1636
Для расширенного кадра данных:
.*_earliest columns should include that lab result with the earliest date.
.*_latest columns should include that lab result with the latest date.
.*_change columns should hold the relative change (variation), (Latest - Earliest) / Earliest.