From d6ebda89d7b52281b31e22acc1766002af6aff1b Mon Sep 17 00:00:00 2001 From: hannahlowens Date: Sun, 23 Jun 2024 16:33:38 +0200 Subject: [PATCH] Make package citation optional --- CRAN-SUBMISSION | 4 ++-- NEWS.md | 1 + R/occCitePrint.R | 18 ++++++++++++++++-- R/studyTaxonList.R | 4 ++-- cran-comments.md | 1 + docs/news/index.html | 1 + docs/pkgdown.yml | 2 +- docs/reference/studyTaxonList.html | 4 ++-- man/studyTaxonList.Rd | 4 ++-- 9 files changed, 28 insertions(+), 11 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 31726a0..35de7f9 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ Version: 0.5.7 -Date: 2024-06-23 13:30:32 UTC -SHA: 547f788a4430979117ed5e5aea803b043c9921ba +Date: 2024-06-23 14:07:20 UTC +SHA: b4fd865c3f391ceffb6f62e409cafb50737bfa0b diff --git a/NEWS.md b/NEWS.md index 01d68b6..87c1e64 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ * Updated date formatting using `format()` instead of `as.character()` * Updated test files to incorporate rgbif 3.8.0 output changes, make more efficient * In occResults, renamed "Dataset", "DatasetKey", and "DataService" to "datasetName", "datasetKey", "dataService", respectively. +* Made an option for removing package citations # occCite 0.5.6 diff --git a/R/occCitePrint.R b/R/occCitePrint.R index 51e54d6..0770fb8 100644 --- a/R/occCitePrint.R +++ b/R/occCitePrint.R @@ -33,6 +33,12 @@ print.occCiteCitation <- function(x, ...) { bySpecies <- FALSE } + if ("skipPackages" %in% names(args)) { + skipPackages <- args$skipPackages + } else { + skipPackages <- FALSE + } + stopifnot(is(x, "occCiteCitation")) if (!requireNamespace("RefManageR", quietly = TRUE)) { @@ -173,7 +179,11 @@ print.occCiteCitation <- function(x, ...) { packages <- unique(x$occCitationResults[[i]]$occSearch) if ("GBIF" %in% packages) packCit <- c(packCit, "rgbif") if ("BIEN" %in% packages) packCit <- c(packCit, "BIEN") - packCit <- packageCitations(packCit) + if(skipPackages){ + packCit <- NULL + } else { + packCit <- packageCitations(packCit) + } # Print results cat(paste("Species:", names(x$occCitationResults)[[i]], "\n\n")) @@ -202,7 +212,11 @@ print.occCiteCitation <- function(x, ...) { packages <- unique(recordCitations$occSearch) if ("GBIF" %in% packages) packCit <- c(packCit, "rgbif") if ("BIEN" %in% packages) packCit <- c(packCit, "BIEN") - packCit <- packageCitations(packCit) + if(skipPackages){ + packCit <- NULL + } else { + packCit <- packageCitations(packCit) + } # Print results recordCitations <- recordCitations[order(recordCitations$Citation), ] diff --git a/R/studyTaxonList.R b/R/studyTaxonList.R index c5e7bc1..9db3a30 100644 --- a/R/studyTaxonList.R +++ b/R/studyTaxonList.R @@ -9,13 +9,13 @@ #' containing the names of taxa of interest #' #' @param datasources A vector of taxonomic data sources implemented in -#' \code{\link{gnr_resolve}}. You can see the list using +#' \code{\link[taxize]{gnr_resolve}}. You can see the list using #' \code{taxize::gnr_datasources()}. #' #' @return An object of class \code{\link{occCiteData}} containing the type #' of inquiry the user has made --a phylogeny or a vector of names-- and a #' data frame containing input taxa names, the closest match according to -#' \code{\link{gnr_resolve}}, and a list of taxonomic data sources that +#' \code{\link[taxize]{gnr_resolve}}, and a list of taxonomic data sources that #' contain the matching name. #' #' @examples diff --git a/cran-comments.md b/cran-comments.md index f2b386e..d840646 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -5,6 +5,7 @@ This is a package update. In this version, I have: * Updated date formatting using `format()` instead of `as.character()` * Updated test files to incorporate rgbif 3.8.0 output changes, make more efficient * In occResults, renamed "Dataset", "DatasetKey", and "DataService" to "datasetName", "datasetKey", "dataService", respectively. +* Made an option for removing package citations. ## Test environments * local OS X 14.5 install, R 4.3.2 (with and without internet connection) diff --git a/docs/news/index.html b/docs/news/index.html index 35ccb9a..8bd31d5 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -67,6 +67,7 @@

Value

An object of class occCiteData containing the type of inquiry the user has made --a phylogeny or a vector of names-- and a data frame containing input taxa names, the closest match according to -gnr_resolve, and a list of taxonomic data sources that +gnr_resolve, and a list of taxonomic data sources that contain the matching name.

diff --git a/man/studyTaxonList.Rd b/man/studyTaxonList.Rd index 0d1347a..d99fa7c 100644 --- a/man/studyTaxonList.Rd +++ b/man/studyTaxonList.Rd @@ -11,14 +11,14 @@ studyTaxonList(x = NULL, datasources = "GBIF Backbone Taxonomy") containing the names of taxa of interest} \item{datasources}{A vector of taxonomic data sources implemented in -\code{\link{gnr_resolve}}. You can see the list using +\code{\link[taxize]{gnr_resolve}}. You can see the list using \code{taxize::gnr_datasources()}.} } \value{ An object of class \code{\link{occCiteData}} containing the type of inquiry the user has made --a phylogeny or a vector of names-- and a data frame containing input taxa names, the closest match according to -\code{\link{gnr_resolve}}, and a list of taxonomic data sources that +\code{\link[taxize]{gnr_resolve}}, and a list of taxonomic data sources that contain the matching name. } \description{