Learn R Programming

taxize (version 0.6.0)

upstream: Retrieve the upstream taxa for a given taxon name or ID.

Description

This function uses a while loop to continually collect taxa up to the taxonomic rank that you specify in the upto parameter. You can get data from ITIS (itis) or Catalogue of Life (col). There is no method exposed by itis or col for getting taxa at a specific taxonomic rank, so we do it ourselves inside the function.

Usage

upstream(...)

## S3 method for class 'default': upstream(x, db = NULL, upto = NULL, rows = NA, ...)

## S3 method for class 'tsn': upstream(x, db = NULL, upto = NULL, ...)

## S3 method for class 'colid': upstream(x, db = NULL, upto = NULL, ...)

## S3 method for class 'ids': upstream(x, db = NULL, upto = NULL, ...)

Arguments

...
Further args passed on to itis_downstream or col_downstream
x
character; taxons to query.
db
character; database to query. One or both of itis, col.
upto
What taxonomic rank to go down to. One of: 'Superkingdom','Kingdom', 'Subkingdom','Infrakingdom','Phylum','Division','Subphylum','Subdivision','Infradivision', 'Superclass','Class','Subclass','Infraclass','Superorder','Order','Suborder', 'Infraorder','Sup
rows
(numeric) Any number from 1 to inifity. If the default NA, all rows are considered. Note that this parameter is ignored if you pass in a taxonomic id of any of the acceptable classes: tsn, colid.

Value

  • A named list of data.frames with the upstream names of every supplied taxa. You get an NA if there was no match in the database.

Examples

Run this code
## col
upstream("Pinus contorta", db = 'col', upto = 'Genus') # get all genera at one level up
upstream("Abies", db = 'col', upto = 'Genus') # goes to same level, Abies is a genus
upstream('Pinus contorta', db = 'col', upto = 'Family')
upstream('Poa annua', db = 'col', upto = 'Family')
upstream('Poa annua', db = 'col', upto = 'Order')

## itis
upstream(x='Pinus contorta', db = 'itis', upto = 'Genus')

## both
upstream(get_ids('Pinus contorta', db = c('col','itis')), upto = 'Genus')

# Use rows parameter to select certain
upstream('Poa annua', db = 'col', upto = 'Genus')
upstream('Poa annua', db = 'col', upto = 'Genus', rows=1)

# use curl options
res <- upstream('Poa annua', db = 'col', upto = 'Genus', config=verbose())

Run the code above in your browser using DataLab