From ad9887167ff9a6939662e3c6da364f3953d3332e Mon Sep 17 00:00:00 2001 From: Damiano Oldoni Date: Wed, 8 Jun 2022 12:41:21 +0200 Subject: [PATCH] Avoid using importFrom See #86 --- NAMESPACE | 4 ---- R/gbif_has_distribution.R | 13 +++++-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 6f2797d8..d3cc5060 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -36,7 +36,6 @@ importFrom(dplyr,case_when) importFrom(dplyr,count) importFrom(dplyr,desc) importFrom(dplyr,distinct) -importFrom(dplyr,distinct_) importFrom(dplyr,do) importFrom(dplyr,enquo) importFrom(dplyr,filter) @@ -47,7 +46,6 @@ importFrom(dplyr,if_else) importFrom(dplyr,inner_join) importFrom(dplyr,left_join) importFrom(dplyr,mutate) -importFrom(dplyr,mutate_all) importFrom(dplyr,mutate_if) importFrom(dplyr,n) importFrom(dplyr,n_distinct) @@ -103,9 +101,7 @@ importFrom(mgcv,nb) importFrom(mgcv,summary.gam) importFrom(plotly,ggplotly) importFrom(plotly,layout) -importFrom(purrr,cross_df) importFrom(purrr,list_along) -importFrom(purrr,map) importFrom(purrr,map2) importFrom(purrr,map2_chr) importFrom(purrr,map_chr) diff --git a/R/gbif_has_distribution.R b/R/gbif_has_distribution.R index 16198cdf..9b504d9f 100644 --- a/R/gbif_has_distribution.R +++ b/R/gbif_has_distribution.R @@ -11,10 +11,7 @@ #' occurrenceStatus) and establishmentMeans. #' @return a logical, TRUE or FALSE. #' @export -#' @importFrom assertthat assert_that -#' @importFrom rgbif name_usage -#' @importFrom dplyr select %>% distinct_ mutate_all -#' @importFrom purrr map cross_df +#' @importFrom dplyr %>% #' @examples #' # numeric taxonKey, atomic parameters #' gbif_has_distribution(145953242, @@ -115,13 +112,13 @@ gbif_has_distribution <- function(taxon_key, ...) { return(FALSE) } else { # Avoid mismatch due to any upper/lowercase difference - user_properties <- map(user_properties, ~ toupper(.)) - # Check whether at least + user_properties <- purrr::map(user_properties, ~ toupper(.)) + # Check whether at least one property defined by user is present has_distr <- dplyr::intersect( user_properties %>% - cross_df(), + purrr::cross_df(), distr_properties %>% - select(names(user_properties)) %>% + dplyr::select(names(user_properties)) %>% dplyr::distinct() %>% dplyr::mutate(dplyr::across(.cols = everything(), toupper)) ) %>%