Learn R Programming

Nematode (version 0.2.0)

Ecological.Indices: Calculate Ecological Indices of Nematodes

Description

This function calculates various ecological indices based on the provided nematode genus abundance data. It supports a range of indices, including taxonomic diversity, Shannon diversity index, Pielou's evenness index, Simpson's index, and more. Users can specify which indices to calculate or use the default option to calculate all supported indices.

Usage

Ecological.Indices(
  data,
  indices = "All",
  total.abundance = NULL,
  method = NULL,
  ...
)

# S3 method for data.frame Ecological.Indices( data, indices = "All", total.abundance = NULL, method = NULL, ... )

# S3 method for matrix Ecological.Indices( data, indices = "All", total.abundance = NULL, method = NULL, ... )

# S3 method for default Ecological.Indices( data, indices = "All", total.abundance = NULL, method = NULL, ... )

Value

A data frame containing the calculated indices. The data frame includes a Sample.ID column and additional columns for each requested index.

Arguments

data

data.frame or matrix. The nematode abundance table where rows represent samples and columns represent nematode genera. Each element indicates the count of a specific nematode genus in the corresponding sample. Row names must be sample names, and column names must be nematode genus names.

indices

A character vector specifying the ecological indices to be calculated. The following indices are supported:

  • "TD" - Trophic Diversity

  • "H" - Shannon-Wiener Index

  • "J" - Pielou's Evenness Index

  • "Simpson" - Simpson Index

  • "WI" - Wasilewska Index

  • "MI" - Maturity Index

  • "PPI" - Plant Parasite Index

  • "SRI" - Species Richness Index

  • "NCR" - Nematode Channel Ratio

  • "CI" - Channel Index

  • "BI" - Basic Index

  • "EI" - Enrichment Index

  • "SI" - Structure Index

Additionally, specifying All will calculate all supported indices. All is the default value.

total.abundance

A data.frame containing abundance information for the samples. It must match the row names of the input data. Default is NULL. This parameter is required when indices contains SRI.

method

The method to use for calculating the Species Richness Index. Default is NULL, which uses the default method Margalef. Options include:

  • "Margalef": Margalef's Richness Index, calculated as \((S - 1) / \ln(N)\).

  • "Menhinick": Menhinick's Richness Index, calculated as \(S / \sqrt{N}\).

...

Additional arguments (currently unused).

Examples

Run this code
# Example with a data frame
df <- data.frame(
  Cephalobus = c(10, NA, 15),
  Caenorhabditis = c(5, 10, NA),
  Pratylenchus = c(8, 12, 10),
  row.names = c("A", "B", "C")
)
abundance <- data.frame(
  abundance = c(100, 150, 120),
  row.names = c("A", "B", "C")
)
Ecological.Indices(data = df, indices = "All", total.abundance = abundance, method = "Menhinick")

Run the code above in your browser using DataLab