ropensci / taxadb
Showing 1 of 6 files from the diff.
Other files ignored by Codecov
man/get_ids.Rd has changed.
cran-comments.md has changed.
codemeta.json has changed.
README.Rmd has changed.
README.md has changed.

@@ -19,6 +19,8 @@
Loading
19 19
#' @param taxadb_db Connection to from `[td_connect()]`.
20 20
#' @param ignore_case should we ignore case (capitalization) in matching names?
21 21
#' default is `TRUE`.
22 +
#' @param warn should we display warnings on NAs resulting from multiply-resolved matches?
23 +
#' (Unlike unmatched names, these NAs can usually be resolved manually via [filter_id()])
22 24
#' @param ... additional arguments (currently ignored)
23 25
#' @return a vector of IDs, of the same length as the input names Any
24 26
#' unmatched names or multiply-matched names will return as [NA]s.
@@ -58,6 +60,7 @@
Loading
58 60
                    version = latest_version(),
59 61
                    taxadb_db = td_connect(),
60 62
                    ignore_case = TRUE,
63 +
                    warn = TRUE,
61 64
                    ...){
62 65
  format <- match.arg(format)
63 66
  n <- length(names)
@@ -67,7 +70,7 @@
Loading
67 70
  # be compatible with common space delimiters
68 71
  names <- gsub("[_|-|\\.]", " ", names)
69 72
70 -
  df <- filter_name(name = names,
73 +
  taxa <- filter_name(name = names,
71 74
                provider = provider,
72 75
                version = version,
73 76
                collect = TRUE,
@@ -76,7 +79,8 @@
Loading
76 79
    arrange(sort)
77 80
78 81
  out <- vapply(names, function(x){
79 -
    df <- df[df$scientificName == x, ]
82 +
    df <- taxa[x == taxa$scientificName, ]
83 +
    df <- df[!is.na(df$scientificName),]
80 84
81 85
    if(nrow(df) < 1) return(NA_character_)
82 86
@@ -91,12 +95,14 @@
Loading
91 95
    if(length(ids)==1){
92 96
      return(ids)
93 97
    } else {
98 +
      if(warn){
94 99
      warning(paste0("  Found ", bb(length(ids)), " possible identifiers for ",
95 100
                     ibr(x),
96 101
                     ".\n  Returning ", bb('NA'), ". Try ",
97 -
                     bb(paste0("tl('", x, "', '", provider,"')")),
102 +
                     bb(paste0("filter_id('", x, "', '", provider,"')")),
98 103
                     " to resolve manually.\n"),
99 104
              call. = FALSE)
105 +
      }
100 106
      return(NA_character_)
101 107
    }
102 108
  },
Files Coverage
R 88.2%
Project Totals (16 files) 88.2%
1
comment: false
2

3
coverage:
4
  round: up
5
  precision: 1
6

7
  status:
8
    project:
9
      default:
10
        threshold: 1%
11
    patch:
12
      default:
13
        target: auto
14
        threshold: 5%
15
        only_pulls: true
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading