Dear list, ? I would like to aggregate?CVTimeDiff by Fish_ID and Trip and put the result into myarray,i.e. for the example below Trip 1,9 and Fish_ID 1646 I would like to obtain mean= (0.8104876+1.3676631)/2 and put it into myarray[1] . ? mydataframe ? ???? Trip Fish_ID CVTimeDiff 1??? 1,9???? 1646? 0.8104876 2??? 1,9???? 1646? 1.3676631 3? 11,13??? 1647???????? NA ? myarray ? ????????? 1646 1647 1648 1649 1650 1654 1656 1662 1,9?????? NA?? NA?? NA?? NA?? NA?? NA?? NA?? NA 10,11??? NA?? NA?? NA?? NA?? NA?? NA?? NA?? NA 11,13??? NA?? NA?? NA?? NA?? NA?? NA?? NA?? NA ? Could somebody help me with this ? ? Many thanks, ? Juliane