[R] retrieve most abundant species by sample unit

Graham Watt-Gremm sunyata at uvic.ca
Wed Nov 9 00:46:06 CET 2005


Hi R-users:
[R 2.2 on OSX 10.4.3]
I have a (sparse) vegetation data frame with 500 rows (sampling  
units) and 177 columns (plant species) where the data represent %  
cover. I need to summarize the cover data by returning the names of  
the most dominant and the second most dominant species per plot. I  
reduced the data frame to omit cover below 5%; this is what it looks  
like stacked. I have experimented with tapply(), by(), and some  
functions mentioned in archived postings, but I haven't seen anything  
that answers to this directly. Does anybody have any ideas?

      OBJECTID       PolygonID SpeciesCod AbundanceP
1       15006     ANT-CBG-rr1     Leymol    5.00000
3       15008     ANT-CBG-rr1     Ambcha    5.00000
5       15010      ANT-ESH-27     Atrpat   20.00000
6       15011      ANT-ESH-27     Ambcha   10.00000
11      15016      ANT-ESH-28     Salvir   20.00000
14      15019      ANT-ESH-28     Atrpat    5.00000
18      15023 ANT-POR-Rubarm5     Rubarm   60.00000
19      15024 ANT-POR-Rubarm5     Hedhel   40.00000
25      15030      ECO-CBG-A2     Griint    5.00000
27      15032      ECO-CBG-A2     Anngra    5.00000
38      15043      ECO-CBG-A4     Sperub   50.00000

Regards,
Graham Watt-Gremm




More information about the R-help mailing list