count_taxa: Count taxa within a taxlist object.

count_taxaR Documentation

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 signature 'character,missing'
count_taxa(object, na.rm = TRUE, ...)

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

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

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

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).

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().

Value

An integer with the number of taxa.

Author(s)

Miguel Alvarez kamapu78@gmail.com

Examples

## 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)

ropensci/taxlist documentation built on Sept. 17, 2024, 3:39 p.m.