File: tsn_by_vernacular_language.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 (20 lines) | stat: -rw-r--r-- 714 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#' Get tsn by vernacular language
#'
#' @export
#' @inheritParams accepted_names
#' @param language A string containing the language. This is a language string,
#'    not the international language code (character)
#' @return a data.frame
#' @examples \dontrun{
#' tsn_by_vernacular_language(language = "french")
#' }
tsn_by_vernacular_language <- function(language, wt = "json", raw = FALSE, ...) {
  out <- itis_GET("getTsnByVernacularLanguage", list(language = language), wt, ...)
  if (raw || wt == "xml") return(out)
  x <- parse_raw(out)
  if (is.null(x$vernacularTsns) || inherits(x$vernacularTsns, "logical")) {
    tibble::tibble()
  } else {
    dr_op(tibble::as_tibble(x$vernacularTsns), "class")
  }
}