Hdash() matches a list of species counts with the AMBI species list
and calculates H' the Shannon diversity index.
(Shannon, 1948)
Hdash(
df,
by = NULL,
var_species = "species",
var_count = "count",
check_species = TRUE,
df_species = NULL
)a list of two dataframes:
H : results of the AMBI index calculations. For each unique
combination of byvariables the following values are calculated:
H : the Shannon diversity Index, H'
S : the number of species
N : the number of individuals
match : the original dataframe with columns added from the species list.
For a user-specified list provided df_species, all columns will be included.
If the user-specified species list contains only a single column with species
names, then a new column match will be created, with a value of 1 indicating
a match and an NA value where no match was found.
For the default AZTI species list the following additional columns will be included:
group : showing the AMBI species group
RA : indicating that the species is reallocatable according to the
AZTI list. That is, it could be re-assigned to a different species group.
a dataframe of species observations
a vector of column names found in df by which calculations
should be grouped e.g. c("station","date")
name of the column in df containing species names
name of the column in df containing count/density/abundance
boolean, default = TRUE. If TRUE, then only species found in the species list are included in H' index. By default, the AZTI species list is used.
optional dataframe with user-specified species list.
If the function is called with the argument check_species = TRUE then
only species which are successfully matched with the specified species
list are included in the calculations. This is the default. If the function
is called with check_species = FALSEthen all rows are counted.
Shannon, C. E. (1948) "A mathematical theory of communication," in The Bell System Technical Journal, vol. 27, no. 3, pp. 379-423. tools:::Rd_expr_doi("doi:10.1002/j.1538-7305.1948.tb01338.x")
Hdash(test_data, by=c("station"))
Run the code above in your browser using DataLab