Running 'testthat.R' [205s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(traitdataform)
  > 
  > test_check("traitdataform")
  -- 1. Error: gbif taxonomy reachable (@test.map_gbif_taxonomy.R#10)  -----------
  Timeout was reached: Operation timed out after 10006 milliseconds with 0 out of 0 bytes received
  1: expect_known_hash(get_gbif_taxonomy(as.character(carabids$name_correct[1:12])), hash = "22e476b7d0") at testthat/test.map_gbif_taxonomy.R:10
  2: quasi_label(enquo(object), arg = "object")
  3: eval_bare(get_expr(quo), get_env(quo))
  4: get_gbif_taxonomy(as.character(carabids$name_correct[1:12]))
  5: taxize::get_gbifid_(x, messages = verbose)
  6: setNames(lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method), 
         sciname)
  7: lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method)
  8: FUN(X[[i]], ...)
  9: gbif_name_backbone(sciname)
  10: cli$get(query = args, ...)
  11: private$make_request(rr)
  12: crul_fetch(opts)
  13: curl::curl_fetch_memory(x$url$url, handle = x$url$handle)
  
  -- 2. Error: mapping synonyms (@test.map_gbif_taxonomy.R#24)  ------------------
  Timeout was reached: Operation timed out after 10013 milliseconds with 0 out of 0 bytes received
  1: expect_true(get_gbif_taxonomy("Limodromus_assimilis")$scientificNameStd == "Platynus assimilis") at testthat/test.map_gbif_taxonomy.R:24
  2: quasi_label(enquo(object), label, arg = "object")
  3: eval_bare(get_expr(quo), get_env(quo))
  4: get_gbif_taxonomy("Limodromus_assimilis")
  5: taxize::get_gbifid_(temp[[i]]$species[which.max(temp[[i]]$confidence)], messages = verbose)
  6: setNames(lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method), 
         sciname)
  7: lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method)
  8: FUN(X[[i]], ...)
  9: gbif_name_backbone(sciname)
  10: cli$get(query = args, ...)
  11: private$make_request(rr)
  12: crul_fetch(opts)
  13: curl::curl_fetch_memory(x$url$url, handle = x$url$handle)
  
  -- 3. Error: mapping doubtful taxa (@test.map_gbif_taxonomy.R#34)  -------------
  Empty reply from server
  1: expect_match(get_gbif_taxonomy("Rhynchaenus fagi")$warnings, "DOUBTFUL") at testthat/test.map_gbif_taxonomy.R:34
  2: quasi_label(enquo(object), label, arg = "object")
  3: eval_bare(get_expr(quo), get_env(quo))
  4: get_gbif_taxonomy("Rhynchaenus fagi")
  5: taxize::get_gbifid_(x, messages = verbose)
  6: setNames(lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method), 
         sciname)
  7: lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method)
  8: FUN(X[[i]], ...)
  9: gbif_name_backbone(sciname)
  10: cli$get(query = args, ...)
  11: private$make_request(rr)
  12: crul_fetch(opts)
  13: curl::curl_fetch_memory(x$url$url, handle = x$url$handle)
  
  -- 4. Error: mapping lower or higher taxa (@test.map_gbif_taxonomy.R#41)  ------
  Empty reply from server
  1: expect_true(get_gbif_taxonomy("Acrocephalus familiaris kingi")$scientificNameStd == 
         "Acrocephalus familiaris kingi") at testthat/test.map_gbif_taxonomy.R:41
  2: quasi_label(enquo(object), label, arg = "object")
  3: eval_bare(get_expr(quo), get_env(quo))
  4: get_gbif_taxonomy("Acrocephalus familiaris kingi")
  5: taxize::get_gbifid_(x, messages = verbose)
  6: setNames(lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method), 
         sciname)
  7: lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method)
  8: FUN(X[[i]], ...)
  9: gbif_name_backbone(sciname)
  10: cli$get(query = args, ...)
  11: private$make_request(rr)
  12: crul_fetch(opts)
  13: curl::curl_fetch_memory(x$url$url, handle = x$url$handle)
  
  -- 5. Error: not matching (@test.map_gbif_taxonomy.R#52)  ----------------------
  Timeout was reached: Operation timed out after 10001 milliseconds with 0 out of 0 bytes received
  1: expect_true(get_gbif_taxonomy("No_species")$warnings == " No match! Check spelling or lower confidence threshold!") at testthat/test.map_gbif_taxonomy.R:52
  2: quasi_label(enquo(object), label, arg = "object")
  3: eval_bare(get_expr(quo), get_env(quo))
  4: get_gbif_taxonomy("No_species")
  5: taxize::get_gbifid_(x, messages = verbose)
  6: setNames(lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method), 
         sciname)
  7: lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method)
  8: FUN(X[[i]], ...)
  9: gbif_name_backbone(sciname)
  10: cli$get(query = args, ...)
  11: private$make_request(rr)
  12: crul_fetch(opts)
  13: curl::curl_fetch_memory(x$url$url, handle = x$url$handle)
  
  -- 6. Error: mapping of taxa works (@test.standardize.R#9)  --------------------
  Empty reply from server
  1: standardise_taxa(dataset1[c(1, 83, 166, 206, 240, 286, 320, 323, 361, 306, 440), 
         ]) at testthat/test.standardize.R:9
  2: do.call(method, c(list(levels(droplevels(as.factor(x$scientificName)))), method_options))
  3: (function (x, subspecies = TRUE, higherrank = FALSE, verbose = FALSE, fuzzy = TRUE, 
         conf_threshold = 90, resolve_synonyms = TRUE) 
     {
         matchtype = status = confidence = NULL
         temp <- taxize::get_gbifid_(x, messages = verbose)
         for (i in 1:length(temp)) {
             warning_i = ""
             synonym_i = FALSE
             if (nrow(temp[[i]]) == 0) {
                 warning_i <- paste("No matching species concept!")
                 temp[[i]] <- data.frame(scientificName = x[i], matchtype = "NONE", status = "NA", 
                     rank = "species")
             }
             if (!fuzzy & nrow(temp[[i]]) > 0) {
                 temp[[i]] <- subset(temp[[i]], matchtype != "FUZZY")
                 if (nrow(temp[[i]]) == 0) {
                     warning_i <- paste(warning_i, "Fuzzy matching might yield results.")
                 }
             }
             if (!is.null(conf_threshold) & nrow(temp[[i]]) > 0) {
                 temp[[i]] <- subset(temp[[i]], confidence >= conf_threshold)
                 if (nrow(temp[[i]]) == 0) {
                     temp[[i]] <- data.frame(scientificName = x[i], matchtype = "NONE", 
                       status = "NA", rank = "species")
                     warning_i <- paste(warning_i, "No match! Check spelling or lower confidence threshold!")
                 }
             }
             if (any(temp[[i]]$status == "ACCEPTED")) {
                 temp[[i]] <- subset(temp[[i]], status == "ACCEPTED")
                 temp[[i]] <- subset(temp[[i]], temp[[i]]$confidence == max(temp[[i]]$confidence))
                 if (nrow(temp[[i]]) > 1) {
                     temp[[i]] <- temp[[i]][1, ]
                     warning_i <- paste(warning_i, "Selected first of multiple equally ranked concepts!")
                 }
             }
             if (!any(temp[[i]]$status == "ACCEPTED") & any(temp[[i]]$status == "SYNONYM")) {
                 if (resolve_synonyms) {
                     keep <- temp[i]
                     temp[i] <- taxize::get_gbifid_(temp[[i]]$species[which.max(temp[[i]]$confidence)], 
                       messages = verbose)
                     if (temp[[i]][1, ]$status == "ACCEPTED") {
                       temp[[i]] <- subset(temp[[i]], matchtype == "EXACT" & status == 
                         "ACCEPTED")
                       temp[[i]] <- subset(temp[[i]], temp[[i]]$confidence == max(temp[[i]]$confidence))
                       if (nrow(temp[[i]]) > 1) {
                         temp[[i]] <- temp[[i]][1, ]
                         warning_i <- paste(warning_i, "Selected first of multiple equally ranked concepts!")
                       }
                       warning_i <- paste(warning_i, "A synonym was mapped to the accepted species concept!", 
                         sep = " ")
                       synonym_i = TRUE
                     }
                     else {
                       status <- temp[[i]][1, ]$status
                       temp[i] <- keep
                       if (nrow(temp[[i]]) > 1) {
                         temp[[i]] <- temp[[i]][1, ]
                         warning_i <- paste(warning_i, "Selected first of multiple equally ranked concepts!")
                       }
                       warning_i <- paste0(warning_i, " Resolved synonym '", temp[[i]]$species, 
                         "' is labelled '", status, "'. Clarification required!")
                     }
                 }
                 else {
                     temp[[i]] <- subset(temp[[i]], status == "SYNONYM")
                     temp[[i]] <- subset(temp[[i]], temp[[i]]$confidence == max(temp[[i]]$confidence))
                     warning_i <- paste(warning_i, "The provided taxon seems to be a synonym of '", 
                       temp[[i]]$species, "'!", sep = "")
                 }
             }
             if (all(temp[[i]]$status == "DOUBTFUL")) {
                 temp[[i]] <- subset(temp[[i]], status == "DOUBTFUL")
                 warning_i <- paste(warning_i, "Mapped concept is labelled 'DOUBTFUL'!")
                 temp[[i]] <- subset(temp[[i]], temp[[i]]$confidence == max(temp[[i]]$confidence))
                 if (nrow(temp[[i]]) > 1) {
                     temp[[i]] <- temp[[i]][1, ]
                     warning_i <- paste(warning_i, "Selected first of multiple equally ranked concepts!")
                 }
             }
             rankorder <- c("kingdom", "phylum", "class", "order", "family", "genus", 
                 "species", "subspecies")
             if (match(temp[[i]]$rank, rankorder) > 7 & !subspecies) {
                 if (length(strsplit(as.character(temp[[i]]$canonicalname), " ")[[1]]) > 
                     2) {
                     temp[i] <- taxize::get_gbifid_(paste(strsplit(names(temp[i]), " ")[[1]][1:2], 
                       collapse = " "), messages = verbose)
                     temp[[i]] <- subset(temp[[i]], temp[[i]]$confidence == max(temp[[i]]$confidence))
                     warning_i <- paste(warning_i, "Subspecies has been remapped to species concept!", 
                       sep = " ")
                 }
                 else {
                     temp[[i]] <- data.frame(scientificName = x[i], matchtype = "NONE", 
                       rank = "subspecies")
                     warning_i <- paste(warning_i, "No mapping of subspecies name to species was possible!", 
                       sep = " ")
                 }
             }
             if (temp[[i]]$matchtype == "HIGHERRANK") {
                 if (higherrank) {
                     temp[[i]] <- subset(temp[[i]], temp[[i]]$confidence == max(temp[[i]]$confidence))
                     warning_i <- paste(warning_i, "No matching species concept! Entry has been mapped to higher taxonomic level.")
                 }
                 else {
                     temp[[i]] <- data.frame(scientificName = x[i], matchtype = "NONE", 
                       rank = "highertaxon")
                     warning_i <- paste("No matching species concept!", warning_i)
                 }
             }
             if (temp[[i]]$matchtype != "NONE") {
                 temp[[i]] <- data.frame(scientificName = x[i], synonym = synonym_i, scientificNameStd = temp[[i]]$canonicalname, 
                     author = sub(paste0(temp[[i]]$canonicalname, " "), "", temp[[i]]$scientificname), 
                     taxonRank = temp[[i]]$rank, confidence = temp[[i]]$confidence, kingdom = if (is.null(temp[[i]]$kingdom)) 
                       NA
                     else temp[[i]]$kingdom, phylum = if (is.null(temp[[i]]$phylum)) 
                       NA
                     else temp[[i]]$phylum, class = if (is.null(temp[[i]]$class)) 
                       NA
                     else temp[[i]]$class, order = if (is.null(temp[[i]]$order)) 
                       NA
                     else temp[[i]]$order, family = if (is.null(temp[[i]]$family)) 
                       NA
                     else temp[[i]]$family, genus = if (is.null(temp[[i]]$genus)) 
                       NA
                     else temp[[i]]$genus, taxonomy = "GBIF Backbone Taxonomy", taxonID = paste0("http://www.gbif.org/species/", 
                       temp[[i]]$usagekey, ""), warnings = NA)
             }
             else {
                 temp[[i]] <- data.frame(scientificName = x[i], warnings = NA)
             }
             temp[[i]]$warnings <- warning_i
             if (verbose & nchar(warning_i) >= 1) 
                 warning(warning_i)
         }
         out <- data.table::rbindlist(temp, fill = TRUE)
         class(out) <- c("data.frame", "taxonomy")
         return(out)
     })(c("Abax_parallelepipedus", "Calathus_cinctus", "Dromius_angustus", "Limodromus_assimilis", 
     "Miscodira_artica", "Notiophilus_aquaticus", "Trichocellus_placidus"), subspecies = 1, 
         higherrank = 0, verbose = 0, fuzzy = 1, conf_threshold = 90, resolve_synonyms = 1)
  4: taxize::get_gbifid_(x, messages = verbose)
  5: setNames(lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method), 
         sciname)
  6: lapply(sciname, get_gbifd_help, messages = messages, rows = rows, method = method)
  7: FUN(X[[i]], ...)
  8: gbif_name_backbone(sciname)
  9: cli$get(query = args, ...)
  10: private$make_request(rr)
  11: crul_fetch(opts)
  12: curl::curl_fetch_memory(x$url$url, handle = x$url$handle)
  
  == testthat results  ===========================================================
  [ OK: 37 | SKIPPED: 2 | WARNINGS: 2 | FAILED: 6 ]
  1. Error: gbif taxonomy reachable (@test.map_gbif_taxonomy.R#10) 
  2. Error: mapping synonyms (@test.map_gbif_taxonomy.R#24) 
  3. Error: mapping doubtful taxa (@test.map_gbif_taxonomy.R#34) 
  4. Error: mapping lower or higher taxa (@test.map_gbif_taxonomy.R#41) 
  5. Error: not matching (@test.map_gbif_taxonomy.R#52) 
  6. Error: mapping of taxa works (@test.standardize.R#9) 
  
  Error: testthat unit tests failed
  Execution halted