File: any_match_count.R

package info (click to toggle)
r-cran-ritis 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 1,156 kB
  • sloc: sh: 13; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 586 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#' Get any match count.
#'
#' @export
#' @param x text or taxonomic serial number (TSN) (character or numeric)
#' @inheritParams accepted_names
#' @return An integer containing the number of matches the search will return.
#' @examples \dontrun{
#' any_match_count(x = 202385)
#' any_match_count(x = "dolphin")
#' any_match_count(x = "dolphin", wt = "xml")
#' }
any_match_count <- function(x, wt = "json", raw = FALSE, ...) {
  out <- itis_GET("getAnyMatchCount", list(srchKey = x), wt = wt, ...)
  if (raw || wt == "xml") return(out)
  if (!nzchar(out)) 0 else parse_raw(out)$return
}