I have a question when I was trying to arrange the data. I have a data frame like below:
ID price location
1 10.2 A
2 9.0 B
2 9.0 C
3 8.5 F
3 8.5 G
For each unique ID, all the columns are the same except for the location. I want to pivot the table to be like this:
ID price location
1 10.2 A
2 9.0 B C
3 8.5 F G
I want to remove the duplicate IDs and move different location together in one column. I've tried pivot_wider() function, but it didn't work out. I'd appreciate it if someone can help. Thanks!