Suppose I have data for a number of transaction that occur within different states
State Cost
AK, 70
AK, 75
AK, 10
IL, 20
IL, 1050
IL, 235
etc...
How can I compress my data so that I'm only looking at total cost per state? I can only come up with solutions by writing python scripts to compress this data but it seems like R should be able to support this operation.
State Cost
AK, 155
IL, 1305
etc...
Any ideas are greatly appreciated.