sort_taxa: Sort taxa for further print

View source: R/sort_taxa.R

sort_taxaR Documentation

Sort taxa for further print

Description

Sorting taxa in slot taxonRelations will be reflected in printed list by functions such as summary() and indented_list(). This is a wrapper for order().

Usage

sort_taxa(object, ...)

## S3 method for class 'taxlist'
sort_taxa(object, by = "TaxonName", priority, ...)

Arguments

object

Object of class taxlist.

...

Further arguments passed to order().

by

Character value indicating the column name in slot taxonRelations of object which will be used for the sorting. Additionally you can use by = "TaxonName" (the default) to get an alphabetical sorting by accepted names.

priority

Optional vector with values to be set on top of the list. Its class have to match the class of the column by.

Value

An object of class taxlist with sorted relations.

Examples

## Subset with Boraginaceae
tax <- subset(Easplist, TaxonName == "Boraginaceae",
    keep_children = TRUE, keep_parents = TRUE
)
indented_list(tax)

## Sorting names alphabetically
tax <- sort_taxa(tax)
indented_list(tax)

## Setting some names on top of the sorting
tax <- sort_taxa(tax, priority = c("Euploca", "Myosotis", "Cordia monoica"))
indented_list(tax)

kamapu/taxlist documentation built on June 14, 2025, 6:47 a.m.