taxlist (version 0.2.4)

count_taxa: Count taxa within a taxlist object.

Description

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

Usage

count_taxa(object, data, ...)

# S4 method for character,missing count_taxa(object, na.rm = TRUE, ...)

# S4 method for factor,missing count_taxa(object, na.rm = TRUE, ...)

# S4 method for taxlist,missing count_taxa(object, level, ...)

# S4 method for formula,taxlist count_taxa(object, data, include_na = FALSE, suffix = "_count", ...)

Value

An integer with the number of taxa.

Arguments

object

An object containing a taxonomic list or a formula.

data

An object of class taxlist in the formula method.

...

further arguments passed among methods.

na.rm

Logical value, whether NAs have to be removed from the input vector or not.

level

Character value indicating the taxonomic rank of counted taxa.

include_na

Logical value indicating whether NA values in a taxon trait should be considered for counting taxa or just ignored (only used in formula method).

suffix

Character value used as suffix for the counted rank in the output data frame (only used in formula method).

Author

Miguel Alvarez kamapu78@gmail.com

Details

This function is written by convenience in order to reduce code for counting taxa within taxlist objects and it is just a wrapper of length().

Examples

Run this code
## factor method
count_taxa(iris$Species)

## taxlist method
count_taxa(Easplist)

## count only species
count_taxa(Easplist, level = "species")

## using a formula
count_taxa(~life_form, Easplist, include_na = TRUE)

Run the code above in your browser using DataLab