I have the following data frame as shown below
Code | Type | Fee |
---|---|---|
AA | JSON | 10 |
AA | R | 20 |
AA | R | 10 |
DD | PYTHON | 30 |
DD | JSON | 15 |
ZZ | R | 50 |
ZZ | PYTHON | 60 |
ZZ | PYTHON | 10 |
code = c(rep("AA",3), rep("DD",2), rep("ZZ",3))
Type = c("JSON", "R", "R", "PYTHON", "JSON", "R", "PYTHON", "PYTHON")
Fee = c(10,20,10,30,15,50,60,10)
Price = as.data.frame(cbind(code, Type, Fee)); Price$Fee = as.integer(as.character(Price$Fee))
I would like to change the data frame to the one shown below with the Fee summed up accordingly
JSON | R | PYTHON | |
---|---|---|---|
AA | 10 | 30 | 0 |
DD | 15 | 0 | 30 |
ZZ | 0 | 50 | 70 |
Thanks in advance!