My question is very similar to this one but in my case, I want the values to be in different columns instead of being concatenated to one.
For example, using the following toy dataframe,
Input:
Patient Value
1 'A'
1 'B'
1 'C'
1 'D'
2 'B'
2
2 'E'
and so on.....
I would like to create a new one where all the measurements are grouped per patient, i.e. Output:
Patient Value1 Value 2 Value 3 Value
1 'A' 'B' 'C' 'D'
2 'B' 'E'
Please note the absence of a value is still taken into account. How can I do that in R?