From 3599080424eeda42b60dd25520dfcf57ee3b1dbd Mon Sep 17 00:00:00 2001 From: Daniel Falster Date: Mon, 6 May 2024 17:22:51 +1000 Subject: [PATCH 01/16] Bump version number (1.0.0.9000) [skip ci] --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3ba66588..bc69a063 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: APCalign Title: Resolving Plant Taxon Names Using the Australian Plant Census -Version: 1.0.0 +Version: 1.0.0.9000 Authors@R: c( person(given = "Daniel", family = "Falster", role = c("aut", "cre", "cph"), email = "daniel.falster@unsw.edu.au", comment = c(ORCID = "0000-0002-9814-092X")), person(given = "Elizabeth", family = "Wenk", role = c("aut", "ctb"), email = "e.wenk@unsw.edu.au", comment = c(ORCID = "0000-0001-5640-5910")), From 6acbeac597e054dfefee280dfc09686b0e2ae526 Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Wed, 29 May 2024 14:20:00 +1000 Subject: [PATCH 02/16] spelling fixes and removing special Mac install instructions (#229) * spelling fixes and removing special Mac install instructions * adding mac back into CI --- .github/workflows/R-CMD-check.yaml | 1 + NEWS.md | 2 +- R/align_taxa.R | 2 +- R/update_taxonomy.R | 2 +- README.Rmd | 32 +++----- README.md | 101 ++++++++++--------------- man/align_taxa.Rd | 2 +- man/update_taxonomy.Rd | 2 +- vignettes/APCalign.Rmd | 15 ++-- vignettes/articles/reproducibility.Rmd | 2 +- 10 files changed, 64 insertions(+), 97 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 9cfbc7f2..a0ee130e 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -18,6 +18,7 @@ jobs: fail-fast: false matrix: config: + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - {os: ubuntu-latest, r: 'release'} - {os: ubuntu-latest, r: 'oldrel-1'} diff --git a/NEWS.md b/NEWS.md index 624ae906..a1dce0ec 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,7 +12,7 @@ streamlined the package. * Write a replacement function for `stringr::word` that is much faster. * Additional speed up and accuracy of fuzzy_match function by - Restricting reference list to names with the same first letter as input string. - - Switch from using `utils::adist` to `stringdist:stringdist(method = "dl")` + - Switch from using `utils::adist` to `stringdist::stringdist(method = "dl")` * Rework `standardise_names` to remove punctuation from the start of the string * Rework `strip_names_extra` (previously `strip_names_2`) to just perform additional functions to `strip_names`, rather than repeating those performed by `strip_names`. diff --git a/R/align_taxa.R b/R/align_taxa.R index 5d36616e..a261eb95 100644 --- a/R/align_taxa.R +++ b/R/align_taxa.R @@ -22,7 +22,7 @@ #' 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; +#' be aligned to a genus (hybrids that are not in the APC/APNI; graded species; #' taxa not identified to species), and indicates these names only have a #' genus-rank match. #' diff --git a/R/update_taxonomy.R b/R/update_taxonomy.R index 80012ab3..ebc0b053 100644 --- a/R/update_taxonomy.R +++ b/R/update_taxonomy.R @@ -18,7 +18,7 @@ #' Notes: #' - As the input for this function is a table with 5 columns (output by #' align_taxa), this function will only be used when you explicitly want to -#' separate the aligment and updating components of APCalign. This function is +#' separate the alignment and updating components of APCalign. This function is #' the second half of create_taxonomic_update_lookup. #' #' @family taxonomic alignment functions diff --git a/README.Rmd b/README.Rmd index 182928d5..424c2b0b 100644 --- a/README.Rmd +++ b/README.Rmd @@ -25,35 +25,23 @@ library(APCalign) # APCalign -'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. +`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. It's useful for updating species list and intersecting them with the APC consensus understanding of established status (native/introduced). ## Installation -For Windows and Linux: - ```{r install, eval= FALSE} -# install.packages("remotes") -# remotes::install_github("traitecoevo/APCalign", dependencies = TRUE, upgrade = "ask") - -``` - -for MacOS there is currently an extra line needed to install a working binary of the `arrow` dependency from r-universe instead of CRAN: - -```{r install_mac, eval= FALSE} - -# install.packages("arrow", repos = c('https://apache.r-universe.dev', 'https://cloud.r-project.org')) -# remotes::install_github("traitecoevo/APCalign", dependencies = TRUE, upgrade = "ask") - + install.packages("remotes") + remotes::install_github("traitecoevo/APCalign") + ``` - ## A quick demo Generating a look-up table can be done with just one function: -```{r} +```{r,message=FALSE} library(APCalign) @@ -68,7 +56,7 @@ create_taxonomic_update_lookup( if you're going to use APCalign more than once, it will save you time to load the taxonomic resources into memory first: -```{r} +```{r,message=FALSE} tax_resources <- load_taxonomic_resources() @@ -83,7 +71,7 @@ create_taxonomic_update_lookup( ) ``` -Checking for Australian natives: +Checking for a list of species to see if they are classified as Australian natives: ```{r, message=FALSE} @@ -96,12 +84,12 @@ We also developed a shiny application for non-R users to update and align their ## Learn more -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). +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). ## Found a bug? -Did you come across an unexpected taxon name change? Elusive error you can't debug - [submit an issue](https://github.com/traitecoevo/APCalign/issues) and we will try our best to help +Did you come across an unexpected taxon name change? Elusive error you can't debug - [submit an issue](https://github.com/traitecoevo/APCalign/issues) and we will try our best to help. ## Comments and contributions diff --git a/README.md b/README.md index 90a13d13..3164276a 100644 --- a/README.md +++ b/README.md @@ -10,31 +10,23 @@ coverage](https://codecov.io/gh/traitecoevo/APCalign/branch/master/graph/badge.s # APCalign -‘APCalign’ uses the [Australian Plant Census +`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. +taxa across different states/territories. It’s useful for updating +species list and intersecting them with the APC consensus understanding +of established status (native/introduced). ## Installation -For Windows and Linux: - ``` r -# install.packages("remotes") -# remotes::install_github("traitecoevo/APCalign", dependencies = TRUE, upgrade = "ask") -``` - -for MacOS there is currently an extra line needed to install a working -binary of the `arrow` dependency from r-universe instead of CRAN: - -``` r - -# install.packages("arrow", repos = c('https://apache.r-universe.dev', 'https://cloud.r-project.org')) -# remotes::install_github("traitecoevo/APCalign", dependencies = TRUE, upgrade = "ask") + install.packages("remotes") + remotes::install_github("traitecoevo/APCalign") + ``` ## A quick demo @@ -52,58 +44,49 @@ create_taxonomic_update_lookup( "Commersonia rosea" ) ) -#> Checking alignments of 3 taxa +#> ================================================================================================================================================================ +#> # A tibble: 3 × 12 +#> original_name aligned_name accepted_name suggested_name genus taxon_rank +#> +#> 1 Banksia integrifol… Banksia int… Banksia inte… Banksia integ… Bank… species +#> 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 , taxonomic_status , +#> # scientific_name , aligned_reason , update_reason , +#> # number_of_collapsed_taxa ``` - #> Loading resources into memory... - #> ================================================================================================================================================================ - #> ...done - #> -> of these 2 names have a perfect match to a scientific name in the APC. Alignments being sought for remaining names. - #> # A tibble: 3 × 12 - #> original_name aligned_name accepted_name suggested_name genus taxon_rank - #> - #> 1 Banksia integrifol… Banksia int… Banksia inte… Banksia integ… Bank… species - #> 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 , taxonomic_status , - #> # scientific_name , aligned_reason , update_reason , - #> # number_of_collapsed_taxa - if you’re going to use APCalign more than once, it will save you time to load the taxonomic resources into memory first: ``` r tax_resources <- load_taxonomic_resources() +#> ================================================================================================================================================================ + +create_taxonomic_update_lookup( + taxa = c( + "Banksia integrifolia", + "Acacia longifolia", + "Commersonia rosea", + "not a species" + ), + resources = tax_resources +) +#> # A tibble: 4 × 12 +#> original_name aligned_name accepted_name suggested_name genus taxon_rank +#> +#> 1 Banksia integrifol… Banksia int… Banksia inte… Banksia integ… Bank… species +#> 2 Acacia longifolia Acacia long… Acacia longi… Acacia longif… Acac… species +#> 3 Commersonia rosea Commersonia… Androcalva r… Androcalva ro… Andr… species +#> 4 not a species +#> # ℹ 6 more variables: taxonomic_dataset , taxonomic_status , +#> # scientific_name , aligned_reason , update_reason , +#> # number_of_collapsed_taxa ``` - #> Loading resources into memory... - #> ================================================================================================================================================================ - #> ...done - - create_taxonomic_update_lookup( - taxa = c( - "Banksia integrifolia", - "Acacia longifolia", - "Commersonia rosea", - "not a species" - ), - resources = tax_resources - ) - #> Checking alignments of 4 taxa - #> -> of these 2 names have a perfect match to a scientific name in the APC. Alignments being sought for remaining names. - #> # A tibble: 4 × 12 - #> original_name aligned_name accepted_name suggested_name genus taxon_rank - #> - #> 1 Banksia integrifol… Banksia int… Banksia inte… Banksia integ… Bank… species - #> 2 Acacia longifolia Acacia long… Acacia longi… Acacia longif… Acac… species - #> 3 Commersonia rosea Commersonia… Androcalva r… Androcalva ro… Andr… species - #> 4 not a species - #> # ℹ 6 more variables: taxonomic_dataset , taxonomic_status , - #> # scientific_name , aligned_reason , update_reason , - #> # number_of_collapsed_taxa - -Checking for Australian natives: +Checking for a list of species to see if they are classified as +Australian natives: ``` r @@ -125,7 +108,7 @@ align their taxonomic names. You can find the application here: 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 +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). @@ -134,7 +117,7 @@ algorithm](https://traitecoevo.github.io/APCalign/articles/updating-taxon-names. Did you come across an unexpected taxon name change? Elusive error you can’t debug - [submit an issue](https://github.com/traitecoevo/APCalign/issues) and we will try -our best to help +our best to help. ## Comments and contributions diff --git a/man/align_taxa.Rd b/man/align_taxa.Rd index c16a3240..7ac0aa32 100644 --- a/man/align_taxa.Rd +++ b/man/align_taxa.Rd @@ -158,7 +158,7 @@ patterns, prioritising exact matches (to accepted names as well as synonyms, orthographic variants) over fuzzy matches. \item It prioritises matches to taxa in the APC over names in the APNI. \item 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; +be aligned to a genus (hybrids that are not in the APC/APNI; graded species; taxa not identified to species), and indicates these names only have a genus-rank match. } diff --git a/man/update_taxonomy.Rd b/man/update_taxonomy.Rd index cf9804c6..44a2f01d 100644 --- a/man/update_taxonomy.Rd +++ b/man/update_taxonomy.Rd @@ -107,7 +107,7 @@ Notes: \itemize{ \item As the input for this function is a table with 5 columns (output by align_taxa), this function will only be used when you explicitly want to -separate the aligment and updating components of APCalign. This function is +separate the alignment and updating components of APCalign. This function is the second half of create_taxonomic_update_lookup. } } diff --git a/vignettes/APCalign.Rmd b/vignettes/APCalign.Rmd index e0c5e2c3..3de7c826 100644 --- a/vignettes/APCalign.Rmd +++ b/vignettes/APCalign.Rmd @@ -9,7 +9,7 @@ vignette: > -When working with biodiversity data, it is important to verify taxonomic names with an authoritative list and correct any out-of-date names. The 'APCalign' package simplifies this process by: +When working with biodiversity data, it is important to verify taxonomic names with an authoritative list and correct any out-of-date names. The `APCalign` package simplifies this process by: - Accessing up-to-date taxonomic information from the [Australian Plant Census](https://biodiversity.org.au/nsl/services/search/taxonomy) and the [Australia Plant Name Index](https://biodiversity.org.au/nsl/services/search/names). - Aligning authoritative names to your taxonomic names using our [fuzzy matching algorithm](https://traitecoevo.github.io/APCalign/articles/updating-taxon-names.html) @@ -17,18 +17,13 @@ When working with biodiversity data, it is important to verify taxonomic names ## Installation -'APCalign' is currently not on CRAN. You can install its current developmental version using - - - ```r -# install.packages("remotes") +install.packages("remotes") remotes::install_github("traitecoevo/APCalign") - library(APCalign) ``` -To demonstrate how to use 'APCalign', we will use an example dataset `gbif_lite` which is documented in `?gbif_lite` +To demonstrate how to use `APCalign`, we will use an example dataset `gbif_lite` which is documented in `?gbif_lite` @@ -52,14 +47,14 @@ gbif_lite |> print(n = 6) ## Retrieve taxonomic resources -The first step is to retrieve the entire APC and APNI name databases and store them locally as taxonomic resources. We achieve this using `load_taxonomic_resources()`. +The first step is to retrieve the entire APC and APNI name databases and store them locally as taxonomic resources. We achieve this using `load_taxonomic_resources()`. The resources are compressed as parquet files to speed download and local loading. There are two versions of the databases that you can retrieve with the `stable_or_current_data` argument. Calling: - `stable` will retrieve the most recent, archived version of the databases from our [GitHub releases](https://github.com/traitecoevo/APCalign/releases). This is set as the default option. - `current` will retrieve the up-to-date databases directly from the APC and APNI website. -Note that the databases are quite large so the initial retrieval of `stable` versions will take a few minutes. Once the taxonomic resources have been stored locally, subsequent retrievals will take less time. Retrieving `current` resources will always take longer since it is accessing the latest information from the website. Check out our [Resource Caching](https://traitecoevo.github.io/APCalign/articles/caching.html) article to learn more about how the APC and APNIC databases are accessed, stored and retrieved. +Note that the databases are reasonably large so the initial retrieval of the core data will take a few minutes. Once the taxonomic resources have been stored locally, subsequent retrievals will take less time. Retrieving `current` resources will always take longer since it is accessing the latest information from the website in an uncompressed format. ```r diff --git a/vignettes/articles/reproducibility.Rmd b/vignettes/articles/reproducibility.Rmd index 0dbb4c37..4090266e 100644 --- a/vignettes/articles/reproducibility.Rmd +++ b/vignettes/articles/reproducibility.Rmd @@ -61,7 +61,7 @@ default_version() Then copying and pasting the output into `load_taxonomic_resources()` directly. This way makes the version of taxonomic resources more explicit in your code. -To ensure the specific version of taxonomic resources is availabe for subsequent functions make sure to assign them to an object: +To ensure the specific version of taxonomic resources is available for subsequent functions make sure to assign them to an object: ```{r} resources_0.0.4.9000 <- load_taxonomic_resources( From c95ddb6c7f37a65700694a6b1263d14b78008f08 Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Thu, 30 May 2024 10:14:16 +1000 Subject: [PATCH 03/16] Cran preparations (#230) * Added example for default_version, updated LICENSE year, added R CMD CHECK results * Comment about Tidy and Mac and HTML validation * Updated CITATION file * Updated version numbers --- DESCRIPTION | 2 +- LICENSE | 2 +- NEWS.md | 6 +----- R/load_taxonomic_resources.R | 2 +- cran-comments.md | 16 ++-------------- inst/CITATION | 3 ++- 6 files changed, 8 insertions(+), 23 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bc69a063..8cafa3e5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: APCalign Title: Resolving Plant Taxon Names Using the Australian Plant Census -Version: 1.0.0.9000 +Version: 1.0.1 Authors@R: c( person(given = "Daniel", family = "Falster", role = c("aut", "cre", "cph"), email = "daniel.falster@unsw.edu.au", comment = c(ORCID = "0000-0002-9814-092X")), person(given = "Elizabeth", family = "Wenk", role = c("aut", "ctb"), email = "e.wenk@unsw.edu.au", comment = c(ORCID = "0000-0001-5640-5910")), diff --git a/LICENSE b/LICENSE index 326c98ed..bad78ab4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,2 +1,2 @@ -YEAR: 2023 +YEAR: 2024 COPYRIGHT HOLDER: Daniel Falster diff --git a/NEWS.md b/NEWS.md index a1dce0ec..bc7e5cc2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# APCalign 1.0.0 +# APCalign 1.0.1 First major release of APCalign. A preprint is available at https://www.biorxiv.org/content/10.1101/2024.02.02.578715v1. @@ -23,10 +23,6 @@ and removing functions from @import * Refine tests * Make messages to console optional * Fix issue with fails when github is down (https://github.com/traitecoevo/APCalign/issues/205) - -# APCalign 0.1.5 - - * Update installation instructions * Added how to cite and version APCalign as an article * Exported `default_version` diff --git a/R/load_taxonomic_resources.R b/R/load_taxonomic_resources.R index 91b2acde..b7b6dbc6 100644 --- a/R/load_taxonomic_resources.R +++ b/R/load_taxonomic_resources.R @@ -372,7 +372,7 @@ dataset_access_function <- #' version is specified. #' #' @return A character string representing the default version for stable data. -#' +#' @example default_version() #' #' @export diff --git a/cran-comments.md b/cran-comments.md index ed3322da..9cff41ac 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,18 +1,6 @@ -## 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 - -## Rev Deps - -* There are no reverse dependencies that needed to be checked - - - +* This is a new release. +* 2 notes with HTML validation problems on MacOS 14.5 diff --git a/inst/CITATION b/inst/CITATION index 4dd88ad2..bab61365 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -1,6 +1,7 @@ bibentry( - bibtype = "Unpublished", + bibtype = "Article", title = "APCalign: an R package workflow and app for aligning and updating flora names to the Australian Plant Census", + journal = "Australian Journal of Botany", author = c( person(given = "Elizabeth", family = "Wenk", role = c("aut", "ctb"), email = "e.wenk@unsw.edu.au", comment = c(ORCID = "0000-0001-5640-5910")), person(given = "Will", family = "Cornwell", role = c("aut", "ctb"), email = "w.cornwell@unsw.edu.au", comment = c(ORCID = "0000-0003-4080-4073")), From 8b7a6196456345eb4a4e9b6ea4df31ea53904cd3 Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Sun, 16 Jun 2024 16:55:30 +1000 Subject: [PATCH 04/16] cleaning up (#231) * Added example for default_version, updated LICENSE year, added R CMD CHECK results * Comment about Tidy and Mac and HTML validation * Updated CITATION file * Updated version numbers * Removed auto package version in citation * Updated CRAN comments * Fixed typo in CITATION * Resubmitted --------- Co-authored-by: Fonti Kar --- CRAN-SUBMISSION | 3 +++ cran-comments.md | 7 +++++-- inst/CITATION | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 CRAN-SUBMISSION diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 00000000..d23661b4 --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 1.0.1 +Date: 2024-05-30 01:18:42 UTC +SHA: be4da3ec059e3058eda7799cc9f6396be459d455 diff --git a/cran-comments.md b/cran-comments.md index 9cff41ac..d84fc516 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -2,5 +2,8 @@ 0 errors | 0 warnings | 0 note -* This is a new release. -* 2 notes with HTML validation problems on MacOS 14.5 + +* This is a resubmission +* Removed `packageVersion()` from CITATION file +* 2 notes with HTML validation problems on MacOS 14.5 + diff --git a/inst/CITATION b/inst/CITATION index bab61365..e856633d 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -13,6 +13,6 @@ bibentry( person(given = "Daniel", family = "Falster", role = c("aut", "cre", "cph"), email = "daniel.falster@unsw.edu.au", comment = c(ORCID = "0000-0002-9814-092X")) ), year = 2024, - note = paste("R package version:", packageVersion("APCalign")), + note = "R package version: 1.0.1", url = "https://www.biorxiv.org/content/10.1101/2024.02.02.578715v1" ) From 94254aa2b2957c6e0e107ffb7ea87042b22ccb7a Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Mon, 17 Jun 2024 11:02:39 +1000 Subject: [PATCH 05/16] fixing badges --- README.Rmd | 3 ++- README.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.Rmd b/README.Rmd index 424c2b0b..3622e46f 100644 --- a/README.Rmd +++ b/README.Rmd @@ -18,7 +18,8 @@ library(APCalign) ``` -[![](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) +[![](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) +[![](https://www.r-pkg.org/badges/version/APCalign?color=orange)](https://cran.r-project.org/package=APCalign) [![Codecov test coverage](https://codecov.io/gh/traitecoevo/APCalign/branch/master/graph/badge.svg)](https://app.codecov.io/gh/traitecoevo/APCalign?branch=master) [![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) diff --git a/README.md b/README.md index 3164276a..1399b181 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ -[![](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) +[![](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) +[![](https://www.r-pkg.org/badges/version/APCalign?color=orange)](https://cran.r-project.org/package=APCalign) [![Codecov test coverage](https://codecov.io/gh/traitecoevo/APCalign/branch/master/graph/badge.svg)](https://app.codecov.io/gh/traitecoevo/APCalign?branch=master) [![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) From d4f2379ea09450ad325b957bffda5939fe48fc75 Mon Sep 17 00:00:00 2001 From: Dave Slager Date: Wed, 19 Jun 2024 21:19:06 -0700 Subject: [PATCH 06/16] Tweaks (#234) * fix example * fix vignette paths --- R/load_taxonomic_resources.R | 3 ++- man/default_version.Rd | 4 ++++ vignettes/updating-taxon-names.Rmd | 15 ++++++++++++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/R/load_taxonomic_resources.R b/R/load_taxonomic_resources.R index b7b6dbc6..b63b4190 100644 --- a/R/load_taxonomic_resources.R +++ b/R/load_taxonomic_resources.R @@ -372,7 +372,8 @@ dataset_access_function <- #' version is specified. #' #' @return A character string representing the default version for stable data. -#' @example default_version() +#' @examples +#' default_version() #' #' @export diff --git a/man/default_version.Rd b/man/default_version.Rd index c0e7e100..86683968 100644 --- a/man/default_version.Rd +++ b/man/default_version.Rd @@ -13,3 +13,7 @@ A character string representing the default version for stable data. This function returns the default version for stable data, which is used when no version is specified. } +\examples{ +default_version() + +} diff --git a/vignettes/updating-taxon-names.Rmd b/vignettes/updating-taxon-names.Rmd index 62a49cea..e3354ff9 100644 --- a/vignettes/updating-taxon-names.Rmd +++ b/vignettes/updating-taxon-names.Rmd @@ -44,18 +44,27 @@ util_kable_styling_html <- function(...) { my_kable_styling <- util_kable_styling_html match_taxa_documentation <- - readr::read_csv(here("inst", "extdata", "match_taxa_documentation.csv"), + readr::read_csv( + system.file( + file.path("extdata", "match_taxa_documentation.csv"), + package = "APCalign"), show_col_types = FALSE ) update_taxonomy_documentation <- - readr::read_csv(here("inst/", "extdata", "update_taxonomy_documentation.csv"), + readr::read_csv( + system.file( + file.path("extdata", "update_taxonomy_documentation.csv"), + package = "APCalign"), show_col_types = FALSE, skip = 1 ) APCalign_outputs_documentation <- - readr::read_csv(here("inst/", "extdata", "APCalign_outputs_documentation.csv"), + readr::read_csv( + system.file( + file.path("extdata", "APCalign_outputs_documentation.csv"), + package = "APCalign"), show_col_types = FALSE ) ``` From 379ca6b2d5716a4c68836ecdb5f33a727e3aa685 Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Wed, 31 Jul 2024 16:31:21 +1000 Subject: [PATCH 07/16] testing for issue #235 --- tests/testthat/test-connection.R | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test-connection.R b/tests/testthat/test-connection.R index 1e630c79..772cb86e 100644 --- a/tests/testthat/test-connection.R +++ b/tests/testthat/test-connection.R @@ -6,10 +6,11 @@ test_that("Complains when network is down", { expect_message(dataset_access_function()) expect_message(dataset_get()) - Sys.setenv("NETWORK_UP" = TRUE) - expect_visible(default_version()) - expect_visible(dataset_access_function()) - expect_visible(dataset_get()) + #commenting out for now to test in CI, see issue #235 + #Sys.setenv("NETWORK_UP" = TRUE) + #expect_visible(default_version()) + #expect_visible(dataset_access_function()) + #expect_visible(dataset_get()) }) From 48567b41563a3a77867c4e3c07ca1fcd77d932fe Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Wed, 31 Jul 2024 16:42:58 +1000 Subject: [PATCH 08/16] still working on #235 --- R/load_taxonomic_resources.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/load_taxonomic_resources.R b/R/load_taxonomic_resources.R index b63b4190..8f88e11b 100644 --- a/R/load_taxonomic_resources.R +++ b/R/load_taxonomic_resources.R @@ -421,7 +421,7 @@ dataset_get <- function(version = default_version(), ## Dummy variable to allow testing of network network <- as.logical(Sys.getenv("NETWORK_UP", unset = TRUE)) - if (!curl::has_internet() | !network) { # Simulate if network is down + if (!curl::has_internet() | !network | is.null(version)) { # Simulate if network is down message("No internet connection, please retry with stable connection (dataset_get)") return(invisible(NULL)) } else{ From 3798dccb55958f6050ff9ca7a4cbcd7abbea15bd Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Wed, 31 Jul 2024 16:48:43 +1000 Subject: [PATCH 09/16] one more try to find the edge case --- R/load_taxonomic_resources.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R/load_taxonomic_resources.R b/R/load_taxonomic_resources.R index 8f88e11b..6a248aae 100644 --- a/R/load_taxonomic_resources.R +++ b/R/load_taxonomic_resources.R @@ -35,7 +35,10 @@ load_taxonomic_resources <- version = default_version(), quiet = FALSE) { - + if(is.null(version)){ + message("No internet connection, please retry with stable connection or specify a local version of the data") + return(invisible(NULL)) + } taxonomic_resources <- dataset_access_function( version = version, @@ -312,7 +315,7 @@ dataset_access_function <- network <- as.logical(Sys.getenv("NETWORK_UP", unset = TRUE)) - if (!curl::has_internet() | !network) { # Simulate if network is down + if (!curl::has_internet() | !network| is.null(version)) { # Simulate if network is down message("No internet connection, please retry with stable connection (dataset_access_function)") return(invisible(NULL)) } From ec50f221383a2aea8adde09b7ba8b6903263fbee Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Wed, 31 Jul 2024 17:00:47 +1000 Subject: [PATCH 10/16] another edge case? --- R/align_taxa.R | 6 ++---- man/align_taxa.Rd | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/R/align_taxa.R b/R/align_taxa.R index a261eb95..cd648bdf 100644 --- a/R/align_taxa.R +++ b/R/align_taxa.R @@ -155,10 +155,9 @@ #' #' @examples #' \donttest{ -#' resources <- load_taxonomic_resources() #' #' # example 1 -#' align_taxa(c("Poa annua", "Abies alba"), resources = resources) +#' align_taxa(c("Poa annua", "Abies alba")) #' #' # example 2 #' input <- c("Banksia serrata", "Banksia serrate", "Banksia cerrata", @@ -168,8 +167,7 @@ #' APCalign::align_taxa( #' original_name = input, #' identifier = "APCalign test", -#' full = TRUE, -#' resources = resources +#' full = TRUE #' ) #' #' } diff --git a/man/align_taxa.Rd b/man/align_taxa.Rd index 7ac0aa32..528d4264 100644 --- a/man/align_taxa.Rd +++ b/man/align_taxa.Rd @@ -188,10 +188,9 @@ sp. [Royal NP]". } \examples{ \donttest{ -resources <- load_taxonomic_resources() # example 1 -align_taxa(c("Poa annua", "Abies alba"), resources = resources) +align_taxa(c("Poa annua", "Abies alba")) # example 2 input <- c("Banksia serrata", "Banksia serrate", "Banksia cerrata", @@ -201,8 +200,7 @@ aligned_taxa <- APCalign::align_taxa( original_name = input, identifier = "APCalign test", - full = TRUE, - resources = resources + full = TRUE ) } From 6e8a76892ec6c31133a9e28f1ef1d534b7f76569 Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Wed, 31 Jul 2024 17:06:28 +1000 Subject: [PATCH 11/16] reformat code in release file --- R/release.R | 135 ++++++++++++++++++++++++++-------------------------- 1 file changed, 68 insertions(+), 67 deletions(-) diff --git a/R/release.R b/R/release.R index 69017010..5e3e635c 100644 --- a/R/release.R +++ b/R/release.R @@ -1,74 +1,75 @@ - #' Download taxonomic resources for GitHub Release +#' Download taxonomic resources for GitHub Release #' #' @param version_name character string of version name, follow semantic versioning #' @param path to download parquets to upload #' @keywords internal #' @noRd -download_taxonomic_resources_for_release<- function(version_name = NULL, path = "ignore/"){ - -# TODO: Use gh package to release programmatically -# body <- paste0('{"tag_name":"',version_name,'","target_commitish":"master","name":"',version_name,'","body":"Download of taxonomic resources from APC and APNI as of ',Sys.Date(),'","draft":true,"prerelease":false,"generate_release_notes":false}') -# -# # Creating release via GH API -# gh::gh("POST /repos/{owner}/{repo}/releases", -# owner = "traitecoevo", repo = "APCalign", -# charToRaw(body), -# .send_headers = c( -# Accept = "application/vnd.github.switcheroo-preview+json", -# "Content-Type" = "application/json" -# ) -# ) - -# Download APC - APC <- - readr::read_csv( - "https://biodiversity.org.au/nsl/services/export/taxonCsv", - col_types = - readr::cols( - .default = readr::col_character(), - proParte = readr::col_logical(), - taxonRankSortOrder = readr::col_double(), - created = readr::col_datetime(format = ""), - modified = readr::col_datetime(format = "") - ) - ) - - # Save APC as parquet -arrow::write_parquet(APC, sink = paste0(path,"apc.parquet")) -# Save APC as tar.gz -readr::write_csv(APC, file = paste0(path,"apc.tar.gz")) - -# Download APNI - APNI <- - readr::read_csv( - "https://biodiversity.org.au/nsl/services/export/namesCsv", - col_types = - readr::cols( - .default = readr::col_character(), - autonym = readr::col_logical(), - hybrid = readr::col_logical(), - cultivar = readr::col_logical(), - formula = readr::col_logical(), - scientific = readr::col_logical(), - nomInval = readr::col_logical(), - nomIlleg = readr::col_logical(), - namePublishedInYear = readr::col_double(), - taxonRankSortOrder = readr::col_double(), - created = readr::col_datetime(format = ""), - modified = readr::col_datetime(format = "") - ) - ) - -# Exclude names that are in APC from APNI - APNI_cleaned <- APNI |> - dplyr::filter(!canonicalName %in% APC$canonicalName) - -# Save APNI as parquet -arrow::write_parquet(APNI_cleaned, sink = paste0(path,"apni.parquet")) - -# Save APNI as tar.gz -readr::write_csv(APNI_cleaned, file = paste0(path,"apni.tar.gz")) - +download_taxonomic_resources_for_release <- function(version_name = NULL, + path = "ignore/") { + # TODO: Use gh package to release programmatically + # body <- paste0('{"tag_name":"',version_name,'","target_commitish":"master","name":"',version_name,'","body":"Download of taxonomic resources from APC and APNI as of ',Sys.Date(),'","draft":true,"prerelease":false,"generate_release_notes":false}') + # + # # Creating release via GH API + # gh::gh("POST /repos/{owner}/{repo}/releases", + # owner = "traitecoevo", repo = "APCalign", + # charToRaw(body), + # .send_headers = c( + # Accept = "application/vnd.github.switcheroo-preview+json", + # "Content-Type" = "application/json" + # ) + # ) + + dir.create("ignore/", showWarnings = FALSE) + + # Download APC + APC <- + readr::read_csv( + "https://biodiversity.org.au/nsl/services/export/taxonCsv", + col_types = + readr::cols( + .default = readr::col_character(), + proParte = readr::col_logical(), + taxonRankSortOrder = readr::col_double(), + created = readr::col_datetime(format = ""), + modified = readr::col_datetime(format = "") + ) + ) + + # Save APC as parquet + arrow::write_parquet(APC, sink = paste0(path, "apc.parquet")) + # Save APC as tar.gz + readr::write_csv(APC, file = paste0(path, "apc.tar.gz")) + + # Download APNI + APNI <- + readr::read_csv( + "https://biodiversity.org.au/nsl/services/export/namesCsv", + col_types = + readr::cols( + .default = readr::col_character(), + autonym = readr::col_logical(), + hybrid = readr::col_logical(), + cultivar = readr::col_logical(), + formula = readr::col_logical(), + scientific = readr::col_logical(), + nomInval = readr::col_logical(), + nomIlleg = readr::col_logical(), + namePublishedInYear = readr::col_double(), + taxonRankSortOrder = readr::col_double(), + created = readr::col_datetime(format = ""), + modified = readr::col_datetime(format = "") + ) + ) + + # Exclude names that are in APC from APNI + APNI_cleaned <- APNI |> + dplyr::filter(!canonicalName %in% APC$canonicalName) + + # Save APNI as parquet + arrow::write_parquet(APNI_cleaned, sink = paste0(path, "apni.parquet")) + + # Save APNI as tar.gz + readr::write_csv(APNI_cleaned, file = paste0(path, "apni.tar.gz")) + } - From 724b6c97884e37a16c0043934e48bb4e83aa9366 Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Wed, 31 Jul 2024 17:11:04 +1000 Subject: [PATCH 12/16] another edge case --- R/align_taxa.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/align_taxa.R b/R/align_taxa.R index cd648bdf..037bec58 100644 --- a/R/align_taxa.R +++ b/R/align_taxa.R @@ -193,6 +193,11 @@ align_taxa <- function(original_name, APNI_matches = TRUE, identifier = NA_character_) { + if(is.null(resources)){ + message("Not finding taxonomic resources; check internet connection?") + return(NULL) + } + if(!quiet) message("Checking alignments of ", dplyr::n_distinct(original_name, na.rm = TRUE), From 98d89217c47e56dcb17bb1135200e14d5073469e Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Wed, 31 Jul 2024 17:13:33 +1000 Subject: [PATCH 13/16] reverting previous commit to documentation --- R/align_taxa.R | 7 +++++-- man/align_taxa.Rd | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/R/align_taxa.R b/R/align_taxa.R index 037bec58..f1d83b4e 100644 --- a/R/align_taxa.R +++ b/R/align_taxa.R @@ -156,8 +156,10 @@ #' @examples #' \donttest{ #' +#' resources <- load_taxonomic_resources() +#' #' # example 1 -#' align_taxa(c("Poa annua", "Abies alba")) +#' align_taxa(c("Poa annua", "Abies alba"), resources=resources) #' #' # example 2 #' input <- c("Banksia serrata", "Banksia serrate", "Banksia cerrata", @@ -167,7 +169,8 @@ #' APCalign::align_taxa( #' original_name = input, #' identifier = "APCalign test", -#' full = TRUE +#' full = TRUE, +#' resources=resources #' ) #' #' } diff --git a/man/align_taxa.Rd b/man/align_taxa.Rd index 528d4264..f5be6086 100644 --- a/man/align_taxa.Rd +++ b/man/align_taxa.Rd @@ -189,8 +189,10 @@ sp. [Royal NP]". \examples{ \donttest{ +resources <- load_taxonomic_resources() + # example 1 -align_taxa(c("Poa annua", "Abies alba")) +align_taxa(c("Poa annua", "Abies alba"), resources=resources) # example 2 input <- c("Banksia serrata", "Banksia serrate", "Banksia cerrata", @@ -200,7 +202,8 @@ aligned_taxa <- APCalign::align_taxa( original_name = input, identifier = "APCalign test", - full = TRUE + full = TRUE, + resources=resources ) } From a99fc67c1c3b10e7dfb863ea5986ea9ea0ab4b4d Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Wed, 31 Jul 2024 17:21:05 +1000 Subject: [PATCH 14/16] adding check on resources to all functions that need resources --- R/create_species_state_origin_matrix.R | 5 +++++ R/create_taxonomic_update_lookup.R | 5 +++++ R/match_taxa.R | 5 +++++ R/native_anywhere_in_australia.R | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/R/create_species_state_origin_matrix.R b/R/create_species_state_origin_matrix.R index c3e20bac..a3d82d11 100644 --- a/R/create_species_state_origin_matrix.R +++ b/R/create_species_state_origin_matrix.R @@ -27,6 +27,11 @@ #' #' create_species_state_origin_matrix <- function(resources = load_taxonomic_resources()) { + if(is.null(resources)){ + message("Not finding taxonomic resources; check internet connection?") + return(NULL) + } + apc_species <- filter_data_to_accepted_species(resources) sep_state_data <- separate_states(apc_species) apc_places <- identify_places(sep_state_data) diff --git a/R/create_taxonomic_update_lookup.R b/R/create_taxonomic_update_lookup.R index 0b3d3349..b9444913 100644 --- a/R/create_taxonomic_update_lookup.R +++ b/R/create_taxonomic_update_lookup.R @@ -170,6 +170,11 @@ create_taxonomic_update_lookup <- function(taxa, resources = load_taxonomic_resources(), quiet = FALSE, output = NULL) { + + if(is.null(resources)){ + message("Not finding taxonomic resources; check internet connection?") + return(NULL) + } validate_taxonomic_splits_input(taxonomic_splits) diff --git a/R/match_taxa.R b/R/match_taxa.R index d7050765..0914eaf5 100644 --- a/R/match_taxa.R +++ b/R/match_taxa.R @@ -53,6 +53,11 @@ match_taxa <- function( identifier = NA_character_ ) { + if(is.null(resources)){ + message("Not finding taxonomic resources; check internet connection?") + return(NULL) + } + update_na_with <- function(current, new) { ifelse(is.na(current), new, current) } diff --git a/R/native_anywhere_in_australia.R b/R/native_anywhere_in_australia.R index cd7aba60..dbd119f1 100644 --- a/R/native_anywhere_in_australia.R +++ b/R/native_anywhere_in_australia.R @@ -32,6 +32,11 @@ native_anywhere_in_australia <- function(species, resources = load_taxonomic_res # Create lookup tables full_lookup <- create_species_state_origin_matrix(resources = resources) + if(is.null(resources)){ + message("Not finding taxonomic resources; check internet connection?") + return(NULL) + } + if (any(!species %in% full_lookup$species)) { warning("At least one input not found in APC; make sure inputs are at the species level and consider using `create_taxonomic_update_lookup` first.") } From adfee1c522b5f8591798f637ad03c798fd963483 Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Wed, 31 Jul 2024 17:42:16 +1000 Subject: [PATCH 15/16] bumping version number and updating readme --- .Rbuildignore | 2 +- DESCRIPTION | 2 +- README.Rmd | 6 +++++- README.md | 7 +++++++ cran-comments.md | 4 ++-- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 7aa8dc0f..a510621b 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -17,4 +17,4 @@ ^cran-comments\.md$ ^CRAN-SUBMISSION$ ^revdep - +^.DS_Store diff --git a/DESCRIPTION b/DESCRIPTION index 8cafa3e5..cfe461a0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: APCalign Title: Resolving Plant Taxon Names Using the Australian Plant Census -Version: 1.0.1 +Version: 1.0.2 Authors@R: c( person(given = "Daniel", family = "Falster", role = c("aut", "cre", "cph"), email = "daniel.falster@unsw.edu.au", comment = c(ORCID = "0000-0002-9814-092X")), person(given = "Elizabeth", family = "Wenk", role = c("aut", "ctb"), email = "e.wenk@unsw.edu.au", comment = c(ORCID = "0000-0001-5640-5910")), diff --git a/README.Rmd b/README.Rmd index 3622e46f..92272397 100644 --- a/README.Rmd +++ b/README.Rmd @@ -29,10 +29,14 @@ library(APCalign) `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. It's useful for updating species list and intersecting them with the APC consensus understanding of established status (native/introduced). -## Installation +## Installation ```{r install, eval= FALSE} + install.packages("APCalign") + + # OR for the github version + install.packages("remotes") remotes::install_github("traitecoevo/APCalign") diff --git a/README.md b/README.md index 1399b181..361f6274 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,10 @@ of established status (native/introduced). ``` r + install.packages("APCalign") + + # OR for the github version + install.packages("remotes") remotes::install_github("traitecoevo/APCalign") @@ -64,6 +68,9 @@ load the taxonomic resources into memory first: tax_resources <- load_taxonomic_resources() #> ================================================================================================================================================================ +``` + +``` r create_taxonomic_update_lookup( taxa = c( diff --git a/cran-comments.md b/cran-comments.md index d84fc516..5115f504 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -4,6 +4,6 @@ * This is a resubmission -* Removed `packageVersion()` from CITATION file -* 2 notes with HTML validation problems on MacOS 14.5 +* More gracefully handling edge cases involving parts of the internet being down +* Better handling an error in the vignette specific to certain MacOS versions From 281fbe55af7d8639e2377ee4c5afb4da6b973be6 Mon Sep 17 00:00:00 2001 From: Will Cornwell Date: Wed, 31 Jul 2024 17:52:15 +1000 Subject: [PATCH 16/16] missed two checking spots --- R/create_species_state_origin_matrix.R | 1 + R/state_diversity_counts.R | 6 ++++++ R/update_taxonomy.R | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/R/create_species_state_origin_matrix.R b/R/create_species_state_origin_matrix.R index a3d82d11..6cee1773 100644 --- a/R/create_species_state_origin_matrix.R +++ b/R/create_species_state_origin_matrix.R @@ -27,6 +27,7 @@ #' #' create_species_state_origin_matrix <- function(resources = load_taxonomic_resources()) { + if(is.null(resources)){ message("Not finding taxonomic resources; check internet connection?") return(NULL) diff --git a/R/state_diversity_counts.R b/R/state_diversity_counts.R index ad0ce302..703dfd14 100644 --- a/R/state_diversity_counts.R +++ b/R/state_diversity_counts.R @@ -28,6 +28,12 @@ #' \donttest{state_diversity_counts(state = "NSW")} state_diversity_counts <- function(state, resources = load_taxonomic_resources()) { + + if(is.null(resources)){ + message("Not finding taxonomic resources; check internet connection?") + return(NULL) + } + valid_inputs <- c( "NSW", "NT", diff --git a/R/update_taxonomy.R b/R/update_taxonomy.R index ebc0b053..5df8993f 100644 --- a/R/update_taxonomy.R +++ b/R/update_taxonomy.R @@ -117,6 +117,11 @@ update_taxonomy <- function(aligned_data, output = NULL, resources = load_taxonomic_resources()) { + if(is.null(resources)){ + message("Not finding taxonomic resources; check internet connection?") + return(NULL) + } + aligned_data <- aligned_data %>% dplyr::select(original_name, aligned_name, taxon_rank, taxonomic_dataset, aligned_reason) %>%