Learn R Programming

Nematode (version 0.2.0)

cal.TD: Calculate Trophic Diversity (TD) Index

Description

This function calculates the Trophic Diversity (TD) Index for ecological communities.

Usage

cal.TD(data, ...)

# S3 method for data.frame cal.TD(data, ...)

# S3 method for matrix cal.TD(data, ...)

# S3 method for default cal.TD(data, ...)

Value

A data frame with two columns:

Sample.ID

Character vector of sample identifiers (from row names of data)

TD

Trophic Diversity index for each sample

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.

...

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")
)
cal.TD(data = df)

Run the code above in your browser using DataLab