I have a Patient Data of 9 months. The dataset includes 4 columns - Patient ID, Visit date, Systolic Blood Pressure (SBP), and Diastolic Blood Pressure (DBP). The patient ID is Unique to everyone. Each Patient has visited the clinic multiple times. Whenever the patient visited their SBP and DBP count was taken.
Sample dataset :
structure(list(PAT_ID = c("PAT134844", "PAT134845", "PAT122062", "PAT134846", "PAT110934", "PAT134844","PAT134845", "PAT134846", "PAT110934", "PAT134846", "PAT122062", "PAT134845", "PAT134844"),
VISIT.DATE = c("1/2/19", "1/2/19", "1/2/19", "1/3/19", "1/3/19", "1/4/19", "3/5/19", "4/5/19", "4/5/19", "6/7/19", "6/7/19", "8/8/19", "8/8/19"),
BP_SYSTOLIC = c("108", "122", "126", "125", "167", "125", "111", "115", "120", "130", "125", "135", "110"),
BP_DIASTOLIC = c("70", "82", "77", "85", "89", "71", "78", "75", "89", "64", "61", "68", "77")), class = "data.frame", row.names = c(NA, -13L))
I want my outcome table to be -
Patient ID | Date 1 | SBP 1 | DBP 1 | Date 2 | SBP 2 | DBP 2 | Date 3 | so on.. |
---|---|---|---|---|---|---|---|---|
CH1234 | 1 january | 120 | 80 | 5 may | 115 | 60 | 7 july | |
CH1235 | 2 january | 130 | 90 | 6 june | 110 | 70 | 8 august |