View source: R/ecological_indices.R
rel_abundance | R Documentation |
This function calculates the relative abundance of nematodes for each sample. The relative abundance is defined as the proportion of each nematode's count to the total count of all nematodes in a sample.
rel_abundance(data, ...)
## S3 method for class 'data.frame'
rel_abundance(data, ...)
## S3 method for class 'matrix'
rel_abundance(data, ...)
## Default S3 method:
rel_abundance(data, ...)
data |
|
... |
Additional arguments (currently unused). |
A data.frame
or matrix
(matching the input type) containing the relative abundance of each nematode in each sample.
# Example with a data frame
df <- data.frame(
Species1 = c(10, NA, 15),
Species2 = c(5, 10, NA),
Species3 = c(8, 12, 10),
row.names = c("A", "B", "C")
)
rel_abundance(df)
# Example with a matrix
mat <- matrix(c(10, NA, 15, 5, 10, NA, 8, 12, 10), nrow = 3, byrow = TRUE)
colnames(mat) <- c("Species1", "Species2", "Species3")
row.names(mat) <- c("A", "B", "C")
rel_abundance(mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.