I have a data set I imported into R, in which there are certain parts of the data set that have two rows of the same time period, but with different values in their deliveries section. I have attached the data set: https://docs.google.com/spreadsheets/d/1n4STItqn_HFwrs_AiwrcIyTwEQYMdpGq/edit?usp=sharing&ouid=109726100465728977286&rtpof=true&sd=true
Is there a way to combine the deliveries values that are of the same year and countrycode?
I have currently tried to use the unique function such as:
ArmsSales <- read_excel("USArmsSales.xlsx")
ArmsSales <- unique(ArmsSales[, Deliveries = sum(Deliveries), by = c("CountryCode", "Year", "Country")])
Also tried to use an aggregate function, but failed terribly. I have seen people recommend code that creates a data frame, but when I tried to do that, or something similar it did not work for me. Any one have advice or a solution?