taxinfo_download: Download taxonomic data

Description Usage Arguments Value References See Also Examples

Description

Download taxonomic data

Usage

1
2
taxinfo_download(query, fq, fields, verbose = nbn_config()$verbose,
  use_data_table = TRUE)

Arguments

query

string: (optional) query of the form field:value (e.g. "genus:Macropus") or a free text search ("Alaba vibex")

fq

string: character string or vector of strings, specifying filters to be applied to the original query. These are of the form "INDEXEDFIELD:VALUE" e.g. "kingdom:Fungi". See nbn_fields("general",as_is=TRUE) for all the fields that are queryable. NOTE that fq matches are case-sensitive, but sometimes the entries in the fields are not consistent in terms of case (e.g. kingdom names "Fungi" and "Plantae" but "ANIMALIA"). fq matches are ANDed by default (e.g. c("field1:abc","field2:def") will match records that have field1 value "abc" and field2 value "def"). To obtain OR behaviour, use the form c("field1:abc OR field2:def")

fields

string vector: (optional) a vector of field names to return. Note that the columns of the returned data frame are not guaranteed to retain the ordering of the field names given here. If not specified, a default list of fields will be returned. See nbn_fields("general",as_is=TRUE) for valid field names. Use fields="all" to include all available fields

verbose

logical: show additional progress information? [default is set by nbn_config()]

use_data_table

logical: if TRUE, attempt to read the data.csv file using the fread function from the data.table package. Requires data.table to be available. If this fails, or use_data_table is FALSE, then read.table will be used (which may be slower)

Value

data frame of results, containing one row per taxon, typically with name, guid, and taxonomic information. The columns returned will depend on the field requested

References

Associated NBN web service: https://api.nbnatlas.org/#ws2

See Also

nbn_fields, nbn_config

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
## simplest usage
x <- taxinfo_download("rk_genus:Macropus")

## Data for Fabaceae with specified fields
x <- taxinfo_download("rk_family:Fabaceae",fields=c("guid","parentGuid","rk_kingdom","rk_phylum",
"rk_class","rk_order","rk_family","rk_genus","scientificName"))
# equivalent direct URL: https://species-ws.nbnatlas.org/download?q=rk_family%3AFabaceae&fields=
# guid%2CparentGuid%2Crk_kingdom%2Crk_phylum%2Crk_class%2Crk_order%2Crk_family%2Crk_genus%
# 2CscientificName

## End(Not run)

fozy81/NBN4R documentation built on May 19, 2019, 8:22 a.m.