Skip to content

Commit

Permalink
CRAN prep and minor fixes to documentation (#173)
Browse files Browse the repository at this point in the history
* simplfying data download and adding a trycatch (#169)  removing contentid for the short term and simplifying data download.

* Graceful testing for load_taxonomic_resources (#164)

* Add GitHub links to DESCRIPTION

* Updated hex #81

* NEWS updates and CRAN comments, Reverse dependency comments

* Updated documentation for create_taxonomic_update_lookup #168

* Minor updates to documentation for resources argument

* Minor documentation changes

---------

Co-authored-by: Will Cornwell <wcornwell@gmail.com>
Co-authored-by: Elizabeth Wenk <ehwenk@gmail.com>
Co-authored-by: Fonti Kar <f.kar@unsw.edu.au>
  • Loading branch information
3 people authored Nov 16, 2023
1 parent 30681f8 commit fd20bdd
Show file tree
Hide file tree
Showing 26 changed files with 85 additions and 110 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
^Meta$
^cran-comments\.md$
^CRAN-SUBMISSION$
^revdep

3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Config/testthat/edition: 3
VignetteBuilder: knitr
URL: https://traitecoevo.github.io/APCalign/
URL: https://traitecoevo.github.io/APCalign/, https://github.com/traitecoevo/APCalign
BugReports: https://github.com/traitecoevo/APCalign/issues
10 changes: 9 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# APCalign 0.1.3

* Refined testing for functions that rely on online resources and network connection

* Better handling of errors when API/network connection is down for `load_taxonomic_resources`

* Refined testing for `load_taxonomic_resources`

* Revised hex - now is .svg!

* Minor update to documentation for 'create_taxonomic_update_lookup'

10 changes: 6 additions & 4 deletions R/align_taxa.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#' Find taxonomic alignments for a list of names to a version of the Australian Plant Census (APC) through standardizing formatting and checking for spelling issues
#'
#' This function uses Australian Plant Census (APC) & the Australian Plant Name Index (APNI) to find taxonomic alignments for a list of names.
#' This function uses Australian Plant Census (APC) & the Australian Plant Name Index (APNI) to find taxonomic alignments for a list of names.
#' It uses the internal function `match_taxa` to attempt to match input strings to taxon names in the APC/APNI.
#' It sequentially searches for matches against more than 20 different string patterns, prioritising exact matches (to accepted names as well as synonyms, orthographic variants)
#' over fuzzy matches. It prioritises matches to taxa in the APC over names in the APNI.
#' It identifies string patterns in input names that suggest a name can only be aligned to a genus (hybrids that are not in the APC/ANI; graded species; taxa not identified to species), and indicates these names only have a genus-rank match.
#'
#' @param original_name A list of names to query for taxonomic alignments.
#' @param output (optional) The name of the file to save the results to.
Expand All @@ -14,9 +18,7 @@
#' @param APNI_matches Name matches to the APNI (Australian Plant Names Index) are turned off as a default.
#' @param identifier A dataset, location or other identifier, which defaults to NA.
#'
#' @return A tibble with columns that include original_name, aligned_name, taxonomic_dataset, taxon_rank, aligned_reason, alignment_code. See Details
#'
#' @details
#' @return A tibble with columns that include original_name, aligned_name, taxonomic_dataset, taxon_rank, aligned_reason, alignment_code.
#' - original_name: the original plant name input.
#' - aligned_name: the original plant name after the function standardise_names has standardised the syntax of infraspecific taxon designations.
#' - taxonomic_dataset: the source of the aligned names (APC or APNI).
Expand Down
2 changes: 1 addition & 1 deletion R/create_species_state_origin_matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @family diversity methods
#' @param resources the taxonomic resources required to make the summary statistics. Loading this can be slow, so call load_taxonomic_resources separately to greatly speed this function up and pass the resources in.
#'
#' @return A data frame with columns representing each state and rows representing each species. The values in each cell represent the origin of the species in that state.
#' @return A tibble with columns representing each state and rows representing each species. The values in each cell represent the origin of the species in that state.
#'
#' @import dplyr
#' @import stringr
Expand Down
10 changes: 3 additions & 7 deletions R/create_taxonomic_update_lookup.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
#' @param stable_or_current_data either "stable" for a consistent version, or "current" for the leading edge version.
#' @param version The version number of the dataset to use.
#' @param taxonomic_splits How to handle one_to_many taxonomic matches. Default is "return_all". The other options are "collapse_to_higher_taxon" and "most_likely_species". most_likely_species defaults to the original_name if that name is accepted by the APC; this will be right for certain species subsets, but make errors in other cases, use with caution.
#' @param full logical for whether the full lookup table is returned or just the two key columns
#' @param full logical for whether the full lookup table is returned or just key columns
#' @param resources These are the taxonomic resources used for cleaning, this will default to loading them from a local place on your computer. If this is to be called repeatedly, it's much faster to load the resources using \code{\link{load_taxonomic_resources}} separately and pass the data in.
#' @param APNI_matches Name matches to the APNI (Australian Plant Names Index) are turned off as a default.
#' @param imprecise_fuzzy_matches Imprecise fuzzy matches are turned off as a default.
#' @param identifier A dataset, location or other identifier, which defaults to NA.
#' @param output file path to save the intermediate output to
#' @return A lookup table containing the accepted and suggested names for each original name input, and additional taxonomic information such as taxon rank, taxonomic status, taxon IDs and genera. See Details.
#'
#' @details
#' @return A lookup table containing the accepted and suggested names for each original name input, and additional taxonomic information such as taxon rank, taxonomic status, taxon IDs and genera.
#' - original_name: the original plant name.
#' - aligned_name: the input plant name that has been aligned to a taxon name in the APC or APNI by the align_taxa function.
#' - accepted_name: the APC-accepted plant name, when available.
Expand Down Expand Up @@ -57,9 +55,7 @@ create_taxonomic_update_lookup <- function(taxa,
APNI_matches = TRUE,
imprecise_fuzzy_matches = FALSE,
identifier = NA_character_,
resources = load_taxonomic_resources(stable_or_current_data =
stable_or_current_data,
version = version),
resources = load_taxonomic_resources(),
output = NULL) {

validate_taxonomic_splits_input(taxonomic_splits)
Expand Down
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#'
#' @format `gbif_lite`
#' A data frame with 129 rows and 7 columns:
#' A tibble with 129 rows and 7 columns:
#' \describe{
#' \item{species}{The name of the first or species of scientificname}
#' \item{infraspecificepithet}{ The name of the lowest or terminal infraspecific epithet of the scientificname}
Expand Down
2 changes: 1 addition & 1 deletion R/load_taxonomic_resources.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Load taxonomic resources from either stable or current versions of APC and APNI
#'
#' Loads taxonomic resources into the global environment. This function accesses taxonomic data from a dataset using the provided version number or the default version. The loaded data contains two lists: APC and APNI, which contain taxonomic information about plant species in Australia. The function creates several data frames by filtering and selecting data from the loaded lists.
#' Loads taxonomic resources into the global environment. This function accesses taxonomic data from a dataset using the provided version number or the default version. The loaded data contains two lists: APC and APNI, which contain taxonomic information about plant species in Australia. The function creates several tibbles by filtering and selecting data from the loaded lists.
#'
#' @param stable_or_current_data Type of dataset to access. The default is "stable", which loads the
#' dataset from a github archived file. If set to "current", the dataset will be loaded from
Expand Down
2 changes: 1 addition & 1 deletion R/state_diversity_counts.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @examples
#' \donttest{state_diversity_counts(state = "NSW")}
state_diversity_counts <- function(state,
resources = load_taxonomic_resources(version = default_version())) {
resources = load_taxonomic_resources()) {
valid_inputs <- c(
"NSW",
"NT",
Expand Down
25 changes: 0 additions & 25 deletions R/update_taxonomy.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,6 @@
#'
#'
#' @return A tibble with updated taxonomy for the specified plant names. The tibble contains the following columns:
#' \itemize{
#' \item \code{original_name}: the original plant name.
#' \item \code{aligned_name}: the input plant name.
#' \item \code{accepted_name}: the APC-accepted plant name, when available.
#' \item \code{suggested_name}: the suggested plant name to use. Identical to the accepted_name, when an accepted_name exists.
#' \item \code{taxonomic_dataset}: the source of the updated taxonomic information (APC or APNI).
#' \item \code{accepted_name_usage_ID}: the unique identifier for the accepted name of the input name.
#' \item \code{canonical_name}: the accepted (or known) scientific name for the input name.
#' \item \code{scientific_name}: the full scientific name, with authorship.
#' \item \code{taxon_rank}: the taxonomic rank of the accepted (or known) name.
#' \item \code{taxonomic_status}: the taxonomic status of the accepted (or known) name.
#' \item \code{taxonomic_status_aligned}: for taxa where there is ambiguity due to a taxon split, the taxonomic status of each possible match.
#' \item \code{aligned_reason}: the explanation of a specific taxon name alignment (from an original name to an aligned name).
#' \item \code{update_reason}: the explanation of a specific taxon name update (from an aligned name to an accepted name).
#' \item \code{genus}: the genus of the accepted (or known) name.
#' \item \code{family}: the family of the accepted (or known) name.
#' \item \code{subclass}: the subclass of the accepted name.
#' \item \code{taxon_distribution}: the distribution of the accepted name.
#' \item \code{taxon_ID}: an identifier for a specific taxon concept.
#' \item \code{taxon_ID_genus}: an identifier for the genus.
#' \item \code{scientific_name_ID}: an identifier for the nomenclatural (not taxonomic) details of a scientific name.
#' \item \code{row_number}: the row number of a specific original_name in the input.
#' }
#'
#' @details
#' - original_name: the original plant name.
#' - aligned_name: the input plant name that has been aligned to a taxon name in the APC or APNI by the align_taxa function.
#' - accepted_name: the APC-accepted plant name, when available.
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ library(APCalign)
[![R-CMD-check](https://github.com/traitecoevo/APCalign/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/traitecoevo/APCalign/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

# APCalign <img src="man/figures/APCalign_hex.png" align="right" width="120"/>
# APCalign <img src="man/figures/APCalign_hex_2.svg" align="right" width="120"/>

'APCalign' uses the [Australian Plant Census (APC)](https://biodiversity.org.au/nsl/services/search/taxonomy) and [Australian Plant Name Index](https://biodiversity.org.au/nsl/services/search/names) to align and update Australian plant taxon name strings. 'APCalign' also supplies information about
the established status (native/introduced) of plant taxa across different states/territories.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ coverage](https://codecov.io/gh/traitecoevo/APCalign/branch/master/graph/badge.s
[![R-CMD-check](https://github.com/traitecoevo/APCalign/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/traitecoevo/APCalign/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

# APCalign <img src="man/figures/APCalign_hex.png" align="right" width="120"/>
# APCalign <img src="man/figures/APCalign_hex_2.svg" align="right" width="120"/>

‘APCalign’ uses the [Australian Plant Census
(APC)](https://biodiversity.org.au/nsl/services/search/taxonomy) and
Expand Down Expand Up @@ -54,8 +54,8 @@ create_taxonomic_update_lookup(
#> 2 Acacia longifolia Acacia long… Acacia longi… Acacia longif… Acac… species
#> 3 Commersonia rosea Commersonia… Androcalva r… Androcalva ro… Andr… species
#> # ℹ 6 more variables: taxonomic_dataset <chr>, taxonomic_status <chr>,
#> # scientific_name_authorship <chr>, aligned_reason <chr>,
#> # update_reason <chr>, number_of_collapsed_taxa <dbl>
#> # scientific_name <chr>, aligned_reason <chr>, update_reason <chr>,
#> # number_of_collapsed_taxa <dbl>
```

## Learn more
Expand All @@ -64,7 +64,7 @@ Highly recommend looking at our [Getting
Started](https://traitecoevo.github.io/APCalign/articles/APCalign.html)
vignette to learn about how to use ‘APCalign’. You can also learn more
about our [taxa matching
algorithm](https://traitecoevo.github.io/APCalign/articles/updating-taxon-names.html)
algorithm](https://traitecoevo.github.io/APCalign/articles/updating-taxon-names.html)
and how [APC/APNI data is
cached](https://traitecoevo.github.io/APCalign/articles/caching.html)
behind-the-scenes.
Expand Down
15 changes: 14 additions & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
## Resubmission
This is a resubmission. This version we have:

* Added measures to gracefully fail should API/internet resources/network is down.

* Minor update to documentation for one function

## R CMD check results

0 errors | 0 warnings | 0 note

* This is a new release.

## Rev Deps

* There are no reverse dependencies that needed to be checked



24 changes: 14 additions & 10 deletions inst/figures/hex.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
library(hexSticker)

imgurl <- file.path("inst/figures/wattle2.png")
sticker(imgurl, package="APCalign",
p_size = 30,
p_x = 1, p_y = 0.70,
s_x=1.5, s_y=1,
s_width=0.9, s_height = 0.9,
p_color = "goldenrod4",
h_color = "goldenrod1",
h_fill = "white",
filename="man/figures/APCalign_hex.png")
imgurl <- file.path("inst/figures/APCalign_v2.png")
sticker(
imgurl,
package=" ",
# p_size = 30,
# p_x = 1, p_y = 0.70,
s_x=1, s_y=1.1,
s_width=0.85, s_height = 0.85,
# p_color = "goldenrod4",
h_color = "#B38E21",
h_fill = "#FBF8C7",
filename="man/figures/APCalign_hex_2.png"
)

Binary file removed inst/figures/wattle2.png
Binary file not shown.
2 changes: 2 additions & 0 deletions man/APCalign.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions man/align_taxa.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_species_state_origin_matrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 6 additions & 9 deletions man/create_taxonomic_update_lookup.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed man/figures/APCalign_hex.png
Binary file not shown.
1 change: 1 addition & 0 deletions man/figures/APCalign_hex_2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed man/figures/ausflora_hex2.png
Binary file not shown.
2 changes: 1 addition & 1 deletion man/gbif_lite.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fd20bdd

Please sign in to comment.