I am using the 'esoph' data in R. It is a data frame with records for 88 age/alcohol/tobacco combinations. Here is an excerpt of its data:
What I am trying to achieve is to pracitcally remove the alcgp column but keep its data for the ncases and ncontrols columns. So for every entry which has the same age group (agegp) and tobacco group (tobgp) but different alcohol group (alcgp) to add up the values for cases and controls and store them in a single row.
For example row 1, 5, 9, 12 would be merged.