Title: | Parse Scientific Names |
---|---|
Description: | Parse scientific names using 'gnparser' (<https://github.com/gnames/gnparser>), written in Go. 'gnparser' parses scientific names into their component parts; it utilizes a Parsing Expression Grammar specifically for scientific names. |
Authors: | Scott Chamberlain [aut] |
Maintainer: | Joel H. Nitta <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.0 |
Built: | 2024-08-29 23:10:48 UTC |
Source: | https://github.com/ropensci/rgnparser |
extract names using gnparser
gn_parse( x, threads = 1, batch_size = NULL, ignore_tags = FALSE, cultivar = FALSE, capitalize = FALSE, diaereses = FALSE, details = FALSE )
gn_parse( x, threads = 1, batch_size = NULL, ignore_tags = FALSE, cultivar = FALSE, capitalize = FALSE, diaereses = FALSE, details = FALSE )
x |
(character) vector of scientific names. required |
threads |
(integer/numeric) number of threads to run for parallel
processing. Setting to |
batch_size |
(integer/numeric) maximum number of names in a
batch send for processing. default: |
ignore_tags |
(logical) ignore HTML entities and tags when
parsing. default: |
cultivar |
(logical) adds support for botanical cultivars like
|
capitalize |
(logical) capitalizes the first letter of name-strings.
default: |
diaereses |
(logical) preserves diaereses within names, e.g.
|
details |
(logical) Return more details for a parsed name |
a list
trys <- function(x) try(x, silent=TRUE) if (interactive()) { x <- c("Quadrella steyermarkii (Standl.) Iltis & Cornejo", "Parus major Linnaeus, 1788", "Helianthus annuus var. texanus") trys(gn_parse(x[1])) trys(gn_parse(x[2])) trys(gn_parse(x[3])) trys(gn_parse(x)) # details w <- trys(gn_parse(x, details = TRUE)) w[[1]]$details # details for one name lapply(w, "[[", "details") # details for all names z <- trys(gn_parse(x, details = FALSE)) # compared to regular z }
trys <- function(x) try(x, silent=TRUE) if (interactive()) { x <- c("Quadrella steyermarkii (Standl.) Iltis & Cornejo", "Parus major Linnaeus, 1788", "Helianthus annuus var. texanus") trys(gn_parse(x[1])) trys(gn_parse(x[2])) trys(gn_parse(x[3])) trys(gn_parse(x)) # details w <- trys(gn_parse(x, details = TRUE)) w[[1]]$details # details for one name lapply(w, "[[", "details") # details for all names z <- trys(gn_parse(x, details = FALSE)) # compared to regular z }
extract names using gnparser into a tidy tibble
gn_parse_tidy( x, threads = 1, batch_size = NULL, cultivar = FALSE, capitalize = FALSE, diaereses = FALSE, ignore_tags = FALSE )
gn_parse_tidy( x, threads = 1, batch_size = NULL, cultivar = FALSE, capitalize = FALSE, diaereses = FALSE, ignore_tags = FALSE )
x |
(character) vector of scientific names. required |
threads |
(integer/numeric) number of threads to run for parallel
processing. Setting to |
batch_size |
(integer/numeric) maximum number of names in a
batch send for processing. default: |
cultivar |
(logical) adds support for botanical cultivars like
|
capitalize |
(logical) capitalizes the first letter of name-strings.
default: |
diaereses |
(logical) preserves diaereses within names, e.g.
|
ignore_tags |
(logical) ignore HTML entities and tags when
parsing. default: |
This function focuses on a data.frame result that's easy
to munge downstream - note that this function does not do additional
details as does gn_parse()
.
a data.frame
trys <- function(x) try(x, silent=TRUE) if (interactive()) { x <- c("Quadrella steyermarkii (Standl.) Iltis & Cornejo", "Parus major Linnaeus, 1788", "Helianthus annuus var. texanus") trys(gn_parse_tidy(x)) }
trys <- function(x) try(x, silent=TRUE) if (interactive()) { x <- c("Quadrella steyermarkii (Standl.) Iltis & Cornejo", "Parus major Linnaeus, 1788", "Helianthus annuus var. texanus") trys(gn_parse_tidy(x)) }
get gnparser version information
gn_version()
gn_version()
named list, with version
and build
trys <- function(x) try(x, silent=TRUE) if (interactive()) { trys(gn_version()) }
trys <- function(x) try(x, silent=TRUE) if (interactive()) { trys(gn_version()) }
The function used to download the appropriate gnparser
executable for your
platform and try to copy it to a system directory so rgnparser can run
the gnparser
command.
This function was deprecated to stay in compliance with CRAN policies
("Packages should not write in the user’s home filespace, nor anywhere else
on the file system apart from the R session’s temporary directory")
Please install gnparser
by hand.
For Linux and Mac users, installing with your usual package manager such as
homebrew is the easiest, see gnparser
documentation for more details:
https://github.com/gnames/gnparser#installation
install_gnparser(version, force)
install_gnparser(version, force)
version |
The gnparser version number, e.g., |
force |
Whether to install gnparser even if it has already been installed. This may be useful when upgrading gnparser. |