Learn R Programming

vegtable (version 0.1.8)

count_taxa: Count taxa included in vegtable objects

Description

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

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.

Usage

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

# S4 method for formula,vegtable count_taxa( object, data, include_lower = FALSE, suffix = "_count", in_header = TRUE, ... )

count_taxa(data, ...) <- value

# S4 method for vegtable,formula count_taxa(data, ...) <- value

Value

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

Arguments

object

An object of class vegtable or a formula.

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.

data

An object of class vegtable.

suffix

Character value used as suffix on the calculated variable.

in_header

Logical value, whether the result should be included in the slot header of the input vegtable object or not. A warning message is provided if the calculation is not done for every plot observation.

value

A formula passed to parameter 'object' by the replace method.

Author

Miguel Alvarez kamapu78@gmail.com

Examples

Run this code
## Different alternatives
count_taxa(Kenya_veg)
head(count_taxa(~ReleveID, Kenya_veg, in_header = FALSE))
head(count_taxa(species ~ ReleveID, Kenya_veg, in_header = FALSE))
head(count_taxa(species ~ ReleveID, Kenya_veg, TRUE, in_header = FALSE))
head(count_taxa(family ~ ReleveID, Kenya_veg, TRUE))

Run the code above in your browser using DataLab