taxlist (version 0.1.7)

df2taxlist: Convert Data Frames into taxlist Objects

Description

Taxon lists may be provided in data frame format, which will be converted to a '>taxlist object.

Usage

# S4 method for data.frame,logical
df2taxlist(x, AcceptedName, ...)

# S4 method for data.frame,missing df2taxlist(x, AcceptedName, ...)

# S4 method for character,missing df2taxlist(x, AcceptedName, ...)

Arguments

x

A data frame or a character vector with taxon names.

AcceptedName

A logical vector indicating accepted names with value TRUE.

...

Additional vectors to be added as columns in slot 'taxonNames'.

Value

A '>taxlist object.

Details

In the method 'data.frame', the input data frame must have following columns:

TaxonUsageID

Numeric code for the name.

TaxonConceptID

Numeric code for the concept.

TaxonName

Full name (usage), excluding author name.

AuthorName

Author of the combination (taxon name).

If the argument 'AcceptedName' is missing, all names will be assumed as accepted names. In the alternative 'character' method, author names have to be added as additional vectors.

Be aware that the resulting object misses any information on taxon views, basionyms, parent concepts, hierarchical levels and taxon traits. All those elements can be added a posteriori by further functions provided in this package.

Examples

Run this code
# NOT RUN {
library(taxlist)

## Read the table with names of Cyperus species
Cyperus <- read.csv(file.path(path.package("taxlist"), "cyperus", "names.csv"),
	stringsAsFactors=FALSE)
head(Cyperus)

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

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

Run the code above in your browser using DataCamp Workspace