Hi R Help list I'm looking to visualise US foreign aid 1946-2009 and I have the dataset for this. The trouble is it's a bit too complex and I need to simply it
I want to merge all of the rows with the same country together and add up the individual totals to make one total figure per country per year Below is an example of the kind of data. The real dataset has 2447 rows and covers 63 years. There are many missing values. Basically I would like to go from the top example to the bottom example and be able to scale it up to cover many more countries and years. Thanks in advance for any help you can offer. country programme FY1985 FY1986 Afghanistan Child Survival and Health 10,000,000 15,000,000 Afghanistan Department of Defense Security Assistance 15,000,000 15,000,000 Afghanistan Narcotics Control NA 5,000,000 Afghanistan Peace Corps NA 7,500,000 Albania Child Survival and Health NA 25,000 Albania Department of Defense Security Assistance NA NA Albania Narcotics Control NA 5,000 Albania Peace Corps NA NA country programme FY1985 FY1986 Afghanistan Child Survival and Health,Department of Defense Security Assistance,Narcotics Control,Peace Corps 25,000,000 42,500,000 Albania Child Survival and Health,Department of Defense Security Assistance,Narcotics Control,Peace Corps NA 30,000 [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.