Learn R Programming

vegtable (version 0.1.4)

count_taxa: Count taxa within a taxlist object

Description

Counting number of taxa within '>taxlist objects or character vectors containing taxon names.

Usage

# S4 method for vegtable
count_taxa(object, level, include_lower=FALSE, ...)

# S4 method for formula count_taxa(object, data, include_lower=FALSE, ...)

Arguments

object

An object of class '>vegtable or a formula.

data

An object of class '>vegtable.

level

Character value indicating the taxonomic rank of counted taxa.

include_lower

Logical value, whether lower taxonomic ranks should be included at the requested level.

...

further arguments passed among methods.

Value

An data frame with the number of taxa from requested level at requested units for the formula method, or just an integer value.

Details

This function provides a quick calculation of taxa in '>vegtable objects, considering only records in slot samples. Such records can be also merged from lower ranks.

For the formula method, units without any requested taxa will not appear in the output data frame. If no taxa at all is occurring at the requested level in any unit, an error message will be retrieved.

Examples

Run this code
# NOT RUN {
library(vegtable)

## Different alternatives
count_taxa(Kenya_veg)
head(count_taxa(~ ReleveID, Kenya_veg))
head(count_taxa(species ~ ReleveID, Kenya_veg))
head(count_taxa(species ~ ReleveID, Kenya_veg, TRUE))
head(count_taxa(family ~ ReleveID, Kenya_veg, TRUE))
# }

Run the code above in your browser using DataLab