File: tsn2lsid.R

package info (click to toggle)
r-cran-ritis 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,156 kB
  • sloc: sh: 13; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 540 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#' Gets the unique LSID for the TSN, or an empty result if there is no match.
#'
#' @export
#' @inheritParams accepted_names
#' @template tsn
#' @return a character string, an LSID, or \code{NULL} if nothing found
#' @examples \dontrun{
#' tsn2lsid(tsn = 155166)
#' tsn2lsid(tsn = 333333333)
#' tsn2lsid(155166, raw = TRUE)
#' tsn2lsid(155166, wt = "xml")
#' }
tsn2lsid <- function(tsn, wt = "json", raw = FALSE, ...) {
  x <- itis_GET("getLSIDFromTSN", list(tsn = tsn), wt, ...)
  if (raw || wt == "xml") return(x)
  parse_raw(x)$return
}