I am trying to collapse this data but I have continuously gotten errors regarding the i and j not being unique. Here is a snippit of the dataset:

country variable total
AUS CAP 20,525
AUS CAP 1,206
AUS CAP 1,475
AUS CAP 79,601
AUS CAP 9,928
AUS CAP 553
AUS CAP 1,180
AUS CAP 1,080

...

AUS EMPE 57
AUS EMPE 58
AUS EMPE 31
AUS EMPE 17
AUS EMPE 61
AUS EMPE 50


I am trying to get it to read like this with these variables:

Country CAP EMPE

With the totals for each. If anyone can help, I'd appreciate it. I don't know where to start!