Graham,
It's relatively easily done, especially the first one.
Let's suppose your veg data frame is called veg
dom1 - apply(veg,1,which.max)
returns a vector with the column number of the species with the highest
abundance for each sample (if there are ties, it returns the first one).
If
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
Your example does not appear to match your description of the problem.
If you want have a 500x177 matrix and want to find the largest and
second largest, you can try something like
m - matrix( sample( 101:115 ), nc=3 )
[,1] [,2] [,3]
[1,] 102 112 110
[2,] 111 106 104
[3,] 108