Hello,

I have a data set with a grouping variable (TRIPID) and  several other
variables.  TRIPID is repeated in some areas and I would like to use a
function like aggregate to sum the variable UNITS according to TRIPID.
However I would also like to retain the other variables as they are in
the data set with the new summed TRIPID.

So what I have is something like this:

YEAR    MONTH   DAY     CONTINUE        SPL     AREA    COUNTY  DEPTH
DEPUNIT GEAR    GEAR2   TRAPS   SOAKTIME        UNITS   FACTOR  DISPOSIT
NUMSETS TRIPST  TRIPID               
1992            1           26              1         SP0073928       8
25         4           NA      1000000     NA          NA
NA              161             1           NA              NA
NA      0216    3399054     1992            1           26
1         SP0073928       8             25         4           NA
1000000     NA          NA              NA              8
1           NA              NA              NA      0216    3399054
1992            1           26              2         SP0004228       8
25         4           NA      1000000     NA          NA
NA              161             1           NA              NA
NA      0216    3399054      1992            1           26
2         SP0004228       8             25         4           NA
1000000     NA          NA              NA              8
1           NA              NA              NA      0216    3399054
1992            1           25              NA      SP0052652       8
25         4           NA      1000000     NA          NA
NA              85              1           NA              NA
NA      0216    3399057       1992            1           26
NA      SP0037940       8             25         4           NA
1000000     NA          NA              NA              70
1           NA              NA              NA      0216    3399058
1992            1           27              NA      SP0072357       8
25         4           NA      1000000     NA          NA
NA              15              1           NA              NA
NA      0216    3399059
1992            1           27              NA      SP0072357       8
25         4           NA      1000000     NA          NA
NA              20              1           NA              NA
NA      0216    3399059     1992            1           27
NA      SP0026324       8             25         4           NA
1000000     NA          NA              NA              8
1           NA              NA              NA      0216    3399060
1992            1           28              1         SP0072357       8
25         4           NA      1000000     NA          NA
NA              200            1           NA              NA
NA      0216    3399062 

And what I want is this:

YEAR    MONTH   DAY     CONTINUE        SPL     AREA    COUNTY  DEPTH
DEPUNIT GEAR    GEAR2   TRAPS   SOAKTIME        UNITS   FACTOR  DISPOSIT
NUMSETS TRIPST  TRIPID               
1992            1           26              1         SP0073928       8
25         4           NA      1000000     NA          NA
NA              338            1           NA              NA
NA      0216    3399054      1992            1           25
NA      SP0052652       8             25         4           NA
1000000     NA          NA              NA              85
1           NA              NA              NA      0216    3399057
1992            1           26              NA      SP0037940       8
25         4           NA      1000000     NA          NA
NA              70              1           NA              NA
NA      0216    3399058
1992            1           27              NA      SP0072357       8
25         4           NA      1000000     NA          NA
NA              35              1           NA              NA
NA      0216    3399059
1992            1           27              NA      SP0026324       8
25         4           NA      1000000     NA          NA
NA              8               1           NA              NA
NA      0216    3399060
1992            1           28              1         SP0072357       8
25         4           NA      1000000     NA          NA
NA              200            1           NA              NA
NA      0216    3399062 

 
Does anyone know how to do this.  Data file is attached.
Thanks in advance

Cameron Guenther, Ph.D. 
Associate Research Scientist
FWC/FWRI, Marine Fisheries Research
100 8th Avenue S.E.
St. Petersburg, FL 33701
(727)896-8626 Ext. 4305
cameron.guenther@myfwc.com

	[[alternative HTML version deleted]]


