Re: [R] Merging rows in a dataframe

2011-06-16 Thread Scott Chamberlain
Something like this could work for you (note that a few other packages would be faster, such as data.table), but plyr is intuitive. require(plyr) # example data set dat <- data.frame(col1 = rep(c("a","b"), each=5), col2 = rep(c("prog1","prog2","prog3","prog4","prog5"), 2), col3 = rnorm(10), co

[R] Merging rows in a dataframe

2011-06-16 Thread Will Parbury
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