trt<-c(1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1, 2, 2, 3 ,3)
plant<-c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5 ,5, 5, 5)
change<-c(-9, -6, -4 , 7 , 4, 11, 18, 5, 29, 10, 29, 36, 10, 9, 4, -1 ,14 ,16 , 9 , 0, -2, 6,14, 18, -6, 13, 11, -1, 7, 15)
df<-data.frame(trt,plant,change)
and I want the result like this-average of the change where first 2 entries are same in trt. my data has 30 rows i want 15 in result,plz help