I'm looking for a way to dynamically transpose row variables and their values into columns and then group them by their unique original row ID's in R. Any help with this would be greatly appreciated.
Current table:
ID | Variable | Value |
---|---|---|
111 | process | assessment |
111 | account number | 7583901264 |
111 | surname | James |
222 | policy number | P761 |
222 | process | review |
222 | account number | 4720129840 |
333 | claim value | $1000.00 |
333 | claim date | 2021-11-12 09:00:00 |
Desired table:
ID | process | account number | surname | policy number | claim value | claim date |
---|---|---|---|---|---|---|
111 | assessment | 7583901264 | James | |||
222 | review | 4720129840 | P761 | |||
333 | $1000.00 | 2021-11-12 09:00:00 |
Keep in mind that not all unique ID's in my original table have the same number of rows and the same type of variables