Skip to contents

Retrieve common (vernacular) names from onezoom for a set of Open Tree of Life IDs.

Usage

ott2common(
  otts,
  lang = "en",
  findall = FALSE,
  include_unpreferred = FALSE,
  nulls = FALSE,
  rate = 5,
  key = NA,
  basereq = NA
)

Arguments

otts

a numeric ID or numeric vector of ott ids indicating the particular taxa to evaluate.

lang

a language code to specify which language to use. This can be a 2 or 3 letter code such as "en" or "fr", or a more specific regional code such as "en-gb" (British English) or "zh-hant" (Chinese, in traditional script). Defaults to "en"

findall

return all names for each OTT, in decreasing order of preference.

include_unpreferred

if findall=FALSE and there is no name marked as "preferred" for this lang, allow for return of names marked as "unpreferred".

nulls

If no common name is present in the specified lang, request that the server returns null instead. Note this is not really necessary to set as this is handled client-side, as such it may be removed.

rate

maximum number of calls to the API per second.

key

your OneZoom API key (defaults to the public key of 0 if not specified).

basereq

an httr2 request object, as generated by oz_basereq(). If NA, uses the default request.

Value

A data frame of the input otts alongside their popularity and popularity rank.

Column Names

If findall=TRUE is set, the output of this function is arbitrarily wide (as each OTT id has an arbitrary number of common names). In this case, the columns are numbered after the initial common column (which is the most preferred name) with names following the formula common_x where x is the rank of the name between 2 and the largest number of common names returned. If not all OTTs have the same number of common names, the extra columns will be filled with NA for those ids.

Author

Francis Windram

Examples

if (FALSE) { # \dontrun{
ott2common(247341)

ott2common(c(247341, 563159, 269666, 504327, 668392), rate=5)

ott2common(c(247341, 563159, 269666, 504327, 668392), findall=TRUE)
} # }