View source: R/ecological_indices.R
| num_species | R Documentation |
This function calculates the number of nematode species present in each sample. It counts the number of non-zero and non-empty nematode species for each sample.
num_species(data, ...)
## S3 method for class 'data.frame'
num_species(data, ...)
## S3 method for class 'matrix'
num_species(data, ...)
## Default S3 method:
num_species(data, ...)
data |
|
... |
Additional arguments (currently unused). |
A data.frame with two columns:
Sample.ID |
Character vector of sample identifiers (from row names) |
NumSpecies |
Number of non-zero nematode species 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")
)
num_species(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")
num_species(mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.