Hi All,

I've been doing circles with this all morning, although I'm sure there's a simple solution. I have a data.frame "pop" as follows:

> pop

   ind  xloc  yloc  gonad
1   1    5     2     12
2   1    5     4     25
3   1    3     3     30
4   1    5     4     10
5   1    1     4     08
.   .    .     .      .
10  1    1     4     11

And I need the following steps:

1. Sum "gonad" by combining (xloc, yloc) as follows and create data.frame "fish":

> fish

   ind  xloc  yloc  gonad
1   1     5     2     12
2   2     5     4     35
3   1     3     3     30
4   2     1     4     19

2. Extract the 2 highest values of "gonad":

> new.fish

   ind  xloc  yloc  gonad
1   2    5     4     35
2   1    3     3     31

3. Delete "fish" from "pop" (2 data.frames).

Hope you get the idea and thanks for any help!!

Nico

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to