I would like to create the following table via a current data frame that I have. My current data frame is as follows
ID = c(rep("A",3), rep("B",5), rep("C",4))
NRT = c(3,3,4,5,5,3,3,4,3,3,5,5)
df = as.data.frame(cbind(ID,NRT))
| ID | NRT | 
|---|---|
| A | 3 | 
| A | 3 | 
| A | 4 | 
| B | 5 | 
| B | 5 | 
| B | 3 | 
| B | 3 | 
| B | 4 | 
| C | 3 | 
| C | 3 | 
| C | 5 | 
| C | 5 | 
I would like to obtain a table as follows which shows the number of times each number appear for each ID
| ID | 3 | 4 | 5 | 
|---|---|---|---|
| A | 2 | 1 | 0 | 
| B | 2 | 1 | 2 | 
| C | 2 | 0 | 2 | 
Thanks all for the help in advance :)