[R] merge data frames taking mean/mode of multiple macthes

2005-01-17 Thread avneet singh
Hello :) I have two data frames, one has properties taken on a piece by piece basis and the other has performance on a lot by lot basis. I wish to combine these two data frames but the problem is that each lot has multiple pieces and hence i need to take a mean of the properties of multiple

Re: [R] merge data frames taking mean/mode of multiple macthes

2005-01-17 Thread Christoph Buser
Dear Avneet the function aggregate (see also ?aggregate) could be useful for your problem. See the short example I've written below. dat1 - data.frame(lot = factor(1:10),y1 = rnorm(10)) str(dat1) dat2 - data.frame(nr = 1:100, lot = factor(rep(1:10, each = 10)),y2 = rnorm(100)) str(dat2)