I have a dataset that has different timepoints for each ID. I want one record per ID where I want the timepoints to be split in different columns . I dont want to use spread as I want the actual value of the column. Some of the IDs have 14 records per ID and I want 14 them split across 14 columns. How can I achieve this in R ?
sample data
ID | Timepoint | Value |
---|---|---|
A | 1 | yes |
A | 2 | yes |
A | 3 | yes |
A | 4 | yes |
B | 7 | yes |
B | 11 | yes |
C | 4 | yes |
C | 5 | yes |
D | 7 | yes |
ID | Timepoint1 | Timepoint2 | Timepoint3 | Timepoint4 | Value |
---|---|---|---|---|---|
A | 1 | 2 | 3 | 4 | yes |
B | 7 | 11 | yes | ||
C | 4 | 5 | yes | ||
D | 7 | yes |