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. |
Version: | 0.3.0 |
License: | MIT + file LICENSE |
URL: | https://docs.ropensci.org/rgnparser/, https://github.com/ropensci/rgnparser |
BugReports: | https://github.com/ropensci/rgnparser/issues |
Encoding: | UTF-8 |
Language: | en-US |
SystemRequirements: | gnparser (<https://github.com/gnames/gnparser>) |
Imports: | sys, tibble, jsonlite, readr, lifecycle |
Suggests: | testthat |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2023-12-11 13:38:23 UTC; as80fywe |
Author: | Scott Chamberlain |
Maintainer: | Joel H. Nitta <joelnitta@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-12-12 11:20:02 UTC |
rgnparser
Description
Parse scientific names using gnparser
gn_debug
Description
DEFUNCT
Usage
gn_debug(...)
Arguments
... |
ignored |
gn_parse
Description
extract names using gnparser
Usage
gn_parse(
x,
threads = 1,
batch_size = NULL,
ignore_tags = FALSE,
cultivar = FALSE,
capitalize = FALSE,
diaereses = FALSE,
details = FALSE
)
Arguments
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 |
Value
a list
Examples
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
}
gn_parse_tidy
Description
extract names using gnparser into a tidy tibble
Usage
gn_parse_tidy(
x,
threads = 1,
batch_size = NULL,
cultivar = FALSE,
capitalize = FALSE,
diaereses = FALSE,
ignore_tags = FALSE
)
Arguments
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: |
Details
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()
.
Value
a data.frame
Examples
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))
}
gn_version
Description
get gnparser version information
Usage
gn_version()
Value
named list, with version
and build
Examples
trys <- function(x) try(x, silent=TRUE)
if (interactive()) {
trys(gn_version())
}
Install gnparser
Description
Reason for deprecating
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")
Solution
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
Usage
install_gnparser(version, force)
Arguments
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. |