Learn R Programming

taxize (version 0.6.0)

children: Retrieve immediate children taxa for a given taxon name or ID.

Description

This function is different from downstream in that it only collects immediate taxonomic children, while downstream collects taxonomic names down to a specified taxonomic rank, e.g., getting all species in a family.

Usage

children(...)

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

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

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

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

## S3 method for class 'uid': children(x, db = NULL, ...)

Arguments

...
Further args passed on to col_children, gethierarchydownfromtsn, or ncbi_children
x
character; taxons to query.
db
character; database to query. One or more of itis, col, or ncbi.
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. NCBI has a method for this function but rows doesn't work.

Value

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

Examples

Run this code
# Plug in taxon names
children("Salmo", db = 'col')
children("Salmo", db = 'itis')
children("Salmo", db = 'ncbi')

# Plug in IDs
(id <- get_colid("Apis"))
children(id)

## Equivalently, plug in the call to get the id via e.g., get_colid into children
identical(children(id), children(get_colid("Apis")))

(id <- get_colid("Apis"))
children(id)
children(get_colid("Apis"))

# Many taxa
(sp <- names_list("genus", 3))
children(sp, db = 'col')
children(sp, db = 'itis')

# Two data sources
(ids <- get_ids("Apis", db = c('col','itis')))
children(ids)
## same result
children(get_ids("Apis", db = c('col','itis')))

# Use the rows parameter
children("Poa", db = 'col')
children("Poa", db = 'col', rows=1)

# use curl options
library("httr")
res <- children("Poa", db = 'col', rows=1, config=verbose())
res <- children("Salmo", db = 'itis', config=verbose())
res <- children("Salmo", db = 'ncbi', config=verbose())

Run the code above in your browser using DataLab