View source: R/ecological_indices.R
| cp_rel_abundance | R Documentation |
This function calculates the relative or absolute abundance of nematodes in different CP (Colonizer-Persister) groups for each sample. The CP groups range from CP1 (colonizers, r-strategists) to CP5 (persisters, K-strategists). Genera without CP classification are grouped as No_CP.
cp_rel_abundance(data, total.abundance = NULL, relative = TRUE, ...)
## S3 method for class 'data.frame'
cp_rel_abundance(data, total.abundance = NULL, relative = TRUE, ...)
## S3 method for class 'matrix'
cp_rel_abundance(data, total.abundance = NULL, relative = TRUE, ...)
## Default S3 method:
cp_rel_abundance(data, total.abundance = NULL, relative = TRUE, ...)
data |
|
total.abundance |
|
relative |
|
... |
Additional arguments (currently unused). |
A data frame with seven columns:
Sample.ID |
Character vector of sample identifiers (from row names of |
CP1 |
Relative or absolute abundance of CP1 group (colonizers, r-strategists) |
CP2 |
Relative or absolute abundance of CP2 group |
CP3 |
Relative or absolute abundance of CP3 group |
CP4 |
Relative or absolute abundance of CP4 group |
CP5 |
Relative or absolute abundance of CP5 group (persisters, K-strategists) |
No_CP |
Relative or absolute abundance of genera without CP classification (only present if such genera exist) |
# 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")
)
cp_rel_abundance(df, abundance, relative = FALSE)
# Example with a matrix
mat <- matrix(c(10, NA, 15, 5, 10, NA, 8, 12, 10), nrow = 3, byrow = TRUE)
colnames(mat) <- c("Cephalobus", "Caenorhabditis", "Pratylenchus")
row.names(mat) <- c("A", "B", "C")
cp_rel_abundance(mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.