Learn R Programming

OnomasticDiversity (version 0.1)

fMargalef: Calculate the Margalef's diversity index

Description

This function obtains the Margalef's diversity index which is a species diversity index developed by Ramon Margalef Lopez during the 1950s. It is a method for quantifying species biodiversity that can be adapted to the context of onomastic.

Usage

fMargalef(x, s, n, location)

Value

A dataframe containing the following components:

location

represents the grouping element, for example the communities / regions.

margalef

the value of the Margalef's diversity index.

Arguments

x

dataframe which contains the number of species and population for each location.

s

name of a variable which represents number of species.

n

name of a variable which represents total number of individuals.

location

name of a variable which represents represents the grouping element.

Author

Maria Jose Ginzo Villamayor

Details

For a community \(i\), the Margalef's diversity index is defined by \(R_1 = \frac{S_i-1}{\ln(N_i)}\), where \(S_i\) represents the number of species (richness) and \(N_i\) represents the total number of individuals in all \(S_i\).

In onomastic context, \(N_i\) denotes the number of individuals in region (\(\approx\) community diversity context) \(i\) and \(S_i\) represents the total number of surnames.

References

Margalef D.R., (1958), Information theory in ecology. International Journal of General Systems, 3, 36--71.

See Also

fMenhinick, fPielou, fShannon, fSheldon, fSimpson, fSimpsonInf, fGeneralisedMean, fGeometricMean, fHeip.

Examples

Run this code
library(sqldf)
data(surnamesgal14)

apes2=sqldf('select  muni, count(surname) as ni,
sum(number) as population from surnamesgal14
group by muni;')

result = fMargalef (x= apes2, s="ni", n="population", location  = "muni")
result

data(namesmengal16)

names2=sqldf('select  muni, count(name) as ni,
sum(number) as population from namesmengal16
group by muni;')

result = fMargalef (x= names2, s="ni", n="population", location  = "muni")
result

data(nameswomengal16)

names2=sqldf('select  muni, count(name) as ni,
sum(number) as population from nameswomengal16
group by muni;')

result = fMargalef (x= names2, s="ni", n="population", location  = "muni")
result

Run the code above in your browser using DataLab