Skip to content
Prev 1176 / 7420 Next

ranks to relative abundances using geometric series

I have data where plant species have been ranked in terms of
contribution to standing biomass, and where the abundance ratio between
the 5th and 1st species has been estimated. I'm using the geometric
series to convert the ranks to relative abundances from this ratio.

It's pretty easy to do so in R. However, I could find no function
already programmed. I think this could be useful instead of having to
rewrite it every time. If one such function exists, can someone please
tell me its name/location, before I go through the hassle of writing
an .Rd help file and adding it to an existing package?

A simple example, but obviously could be improved to allow more options
(e.g. na.rm = TRUE, etc):

# ranks = vectors of ranks (e.g. 1, 2, 3, ...)
# k = constant proportion
# inf = infinite series or finite?

rank2abun <- function(ranks, k, inf = TRUE){
    if (inf) abun <- 100 * (1 - k) * k^(ranks - 1)
    else abun <- 100 * ((1 - k) * k^(ranks - 1) ) / (1 -
k^length(ranks))
    return(abun)
}

# test it
1> rank2abun(1:10, k = 0.3)
 [1] 70.00000000 21.00000000  6.30000000  1.89000000  0.56700000
0.17010000  0.05103000  0.01530900  0.00459270  0.00137781