all,
I have a data frame with thousands of elements along the lines of
rawdata <- data.frame("Pop" = c("A","B","B","C","C") , "ID" = c(1,2,2,1,1))
Pop | ID |
---|---|
A | 1 |
B | 2 |
B | 2 |
C | 1 |
C | 1 |
and am trying to create an output like
ID | A | B | C |
---|---|---|---|
1 | 1 | 0 | 2 |
2 | 0 | 2 | 0 |
But I'm struggling to figure how to do this. Would anyone happen to know a way?
Thank you for your time.