Sorry if this is a bit confusing, but I need to reshape my data from the top part of my photo to the bottom. I have rows of multiple of the same ID's, however I would like to separate them out into different items instead of multiple rows of the same ID. In my photo, the bottom part does have blanks, but they would be filled in with more rows of data.
Asked
Active
Viewed 25 times
1 Answers
0
You can use pivot_wider
function from tidyr
package to achieve this:
library(dplyr)
library(tidyr)
df %>% pivot_wider(., names_from = CandidateID, values_from = Score)
here, I assume that your dataframe is called df
. Also, as you do not provide a reproducible example (in the format described here: How to make a great R reproducible example), I can't test this code on your real data.
So, if it is not working for you, please consider adding a reproducible example

dc37
- 15,840
- 4
- 15
- 32