df2taxlist: Convert data frames and strings into taxlist objects

View source: R/df2taxlist.R

df2taxlistR Documentation

Convert data frames and strings into taxlist objects

Description

Function converting template data frame into taxlist object. Also character vectors including taxonomic names will be converted but without any information on taxonomic ranks and parental taxa.

Usage

df2taxlist(x, ...)

## S3 method for class 'data.frame'
df2taxlist(x, taxonTraits, taxonViews, levels, clean_strings = TRUE, ...)

## S3 method for class 'character'
df2taxlist(x, ...)

Arguments

x

A data frame or a character vector with taxonomic names. If x is a data frame, the columns TaxonUsageID (integer with IDs for each name), TaxonConceptID (integer with IDs for the respective taxon concepts), and TaxonName (character) are mandatory. Other optional columns are AuthorName (character with names' authorities), AcceptedName (logical indicating whether the name is an accepted name or a synonym and will be set as TRUE by default), Level (factor sorting taxonomic ranks in the bottom-up direction), Parent (integer, the taxon concept ID of the parental taxon), and ViewID (integer pointing to the ID of taxonomic view, usually a bibliographic reference, and will be used only if 'taxonViews' is provided. Any further column not included in the prototype of taxlist will be considered as names' attributes and inserted in slot taxonNames.

...

Further arguments passed among methods. For the 'character-method', arguments will be passed to the 'data.frame-method'.

taxonTraits

A data frame with attributes of taxonomic concepts (optional). If provided, the column TaxonConceptID is mandatorial.

taxonViews

A data frame or lib_df with references of taxonomic views (optional). If provided, the column ViewID is mandatorial and have to match the homonymous column at 'x'.

levels

A character vector setting the levels or taxonomic ranks from the bottom to the top. This argument is optional and if missing, the column Level will be preserved (if factor) or coerced to factor, except in the case that no column Level is provided.

clean_strings

Logical value, whether function clean_strings() should be applied to 'x' or not.

Value

A taxlist object.

Author(s)

Miguel Alvarez kamapu78@gmail.com.

Examples

Cyperus <- read.csv(file = file.path(path.package("taxlist"), "cyperus",
  "names.csv"))
head(Cyperus)

## Convert to 'taxlist' object
Cyperus$AcceptedName <- !Cyperus$SYNONYM
df2taxlist(Cyperus)

## Create a 'taxlist' object from character vectors
Plants <- df2taxlist(c("Triticum aestivum", "Zea mays"), AuthorName = "L.")
summary(Plants, "all")

kamapu/taxlist documentation built on Feb. 17, 2024, 8:27 a.m.