I have two data frames - one containing a list of all samples (sample ID, area etc)(sampleid.df) and a second a list of counts (obs.count) made in each sample. What I need is a table which lists ALL samples and provides a sum for all obs.measur (by sampleid) - in addition samples returning no counts should get a 0. I tried aggregate and merge but the difference in length was an issue. Any ideas/suggestions much appreciated.I have two data frames - one containing a list