I'm fairly new to R so apologies for perhaps the naivete of the question, but:
I would like to vertically merge multiple rows in a dataframe based on a duplicate value in one specific column.
My current dataframe looks something like:
| Context | Question ID | Rating |
|---|---|---|
| 1 | Q1Item1 | Public |
| 1 | Q2Item1 | Quite a bit |
| 1 | Q3Item1 | Somewhat |
| 2 | Q1Item2 | Very |
| 2 | Q2Item2 | Very |
| 2 | Q3Item2 | Very |
It does this all the way until Context# 1051.
I would like to end up with a df that looks something like:
| Context | Question ID1 | Rating1 | Question ID2 | Rating2 | Question ID3 | Rating3 |
|---|---|---|---|---|---|---|
| 1 | Q1Item1 | Public | Q2Item1 | Quite a bit | Q3Item1 | Somewhat |
| 2 | Q1Item2 | Very | Q2Item2 | Very | Q3Item2 | Very |
This merge would result in multiple new columns and no duplicates in the "Context" row.
How should I go about completing this?
Thank you very much!!