I'm new to R and have a simple question, as I'm still learning the style of R data manipulation/management.
I have a dataset of observations of basic clinical features (blood pressure, cholesterol, etc) over a period of time. Each observation has a patient ID and date, but are entered as separate line items. Something like this:
Patient ID Date Blood Pressure
1 21/1/14 120
1 19/3/14 134
1 3/5/14 127
I want to transform the data such that for a given variable (e.g. blood pressure), I have a data frame with one line per patient and all of the blood pressure values observed throughout time in chronological order. Something like this:
Patient ID BP1 BP2 BP3
1 120 134 127
I want to do this because I want to be able to write code to select the mean of the first three observed blood pressures, for example.
Any advice or reading recommendations would greatly be appreciated.