Running ‘testthat.R’ [17s/17s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(countries)
  > 
  > test_check("countries")
  
  In total 1 unique country names were provided
  1/1 have been matched with EXACT matching
  0/1 have been matched with FUZZY matching
  
  
  The following country IDs do not have a match in one or more of the requested naming conventions,  NA returned:
  (To avoid NAs, use - to = 'simple'- or set - na_fill = TRUE)
    - Taiwan
  
  All values in argument - x - are NA or NULL
  There is low confidence on the matching of some country names, keeping the original names in - x.
  
  Set - verbose - to TRUE for more details
  There is low confidence on the matching of some country names, returning the closest match.
  
  Set - verbose - to TRUE for more details
  Identifying columns to merge
  No merging keys were found. Will try merging all columns with matching names!
  The following columns are being merged:
  
  =======  ====
  \        freq
  =======  ====
  Table 1  freq
  Table 2  freq
  =======  ====
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  Identifying columns to merge
  No merging keys were found. Will try merging all columns with matching names!
  The following columns are being merged:
  
  =======  ====
  \        freq
  =======  ====
  Table 1  freq
  Table 2  freq
  =======  ====
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  No merging keys were found. Will try merging all columns with matching names!
  The following columns are being merged:
  
  =======  ====
  \        freq
  =======  ====
  Table 1  freq
  Table 2  freq
  =======  ====
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  No merging keys were found. Will try merging all columns with matching names!
  The following columns are being merged:
  
  =======  ====
  \        freq
  =======  ====
  Table 1  freq
  Table 2  freq
  =======  ====
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  No merging keys were found. Will try merging all columns with matching names!
  The following columns are being merged:
  
  =======  ====
  \        freq
  =======  ====
  Table 1  freq
  Table 2  freq
  =======  ====
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  No merging keys were found. Will try merging all columns with matching names!
  The following columns are being merged:
  
  =======  ====
  \        freq
  =======  ====
  Table 1  freq
  Table 2  freq
  =======  ====
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  Table 2 - countries detected in column names, pivoting columns: France, Italy, US
  Converting country names
  No merging key found for Table 1. Data will be appended. 
  The following columns are being merged:
  
  =======  =======================
  \        country                
  =======  =======================
  Table 1                         
  Table 2  Table2_pivoted_colnames
  =======  =======================
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  Table 2 - countries detected in column names, pivoting columns: France, Italy, US
  Converting country names
  No merging key found for Table 1. Data will be appended. 
  The following columns are being merged:
  
  =======  =======================
  \        country                
  =======  =======================
  Table 1                         
  Table 2  Table2_pivoted_colnames
  =======  =======================
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  Table 2 - countries detected in column names, pivoting columns: France, Italy, US
  Converting country names
  No merging key found for Table 1. Data will be appended. 
  The following columns are being merged:
  
  =======  =======================
  \        country                
  =======  =======================
  Table 1                         
  Table 2  Table2_pivoted_colnames
  =======  =======================
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  Identifying columns to merge
  Table 2 - countries detected in column names, pivoting columns: France, Italy, US
  Converting country names
  No merging key found for Table 1. Data will be appended. 
  The following columns are being merged:
  
  =======  =======================
  \        country                
  =======  =======================
  Table 1                         
  Table 2  Table2_pivoted_colnames
  =======  =======================
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  Identifying columns to merge
  Table 2 - countries detected in column names, pivoting columns: France, Italy, US
  Converting country names
  No merging key found for Table 1. Data will be appended. 
  The following columns are being merged:
  
  =======  =======================
  \        country                
  =======  =======================
  Table 1                         
  Table 2  Table2_pivoted_colnames
  =======  =======================
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  Identifying columns to merge
  Table 2 - countries detected in column names, pivoting columns: France, Italy, US
  Converting country names
  No merging key found for Table 1. Data will be appended. 
  The following columns are being merged:
  
  =======  =======================
  \        country                
  =======  =======================
  Table 1                         
  Table 2  Table2_pivoted_colnames
  =======  =======================
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  Table 2 - countries detected in column names, pivoting columns: France, Italy, US
  Converting country names
  No merging key found for Table 1. Data will be appended. 
  The following columns are being merged:
  
  =======  =======================
  \        country                
  =======  =======================
  Table 1                         
  Table 2  Table2_pivoted_colnames
  =======  =======================
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  No merging keys were found. Will try merging all columns with matching names!
  Data type for variable HS differ across tables - converting to character
  Data type for variable freq differ across tables - converting to character
  The following columns are being merged:
  
  =======  ===  ====
  \        HS   freq
  =======  ===  ====
  Table 1  HS   freq
  Table 2  HS       
  Table 3  HS   freq
  =======  ===  ====
  
                                                
  Performing merge: 1/2 
                                                
  Performing merge: 2/2 
                                                
  Merge complete
  Identifying columns to merge
  No merging keys were found. Will try merging all columns with matching names!
  Data type for variable HS differ across tables - converting to character
  Data type for variable freq differ across tables - converting to character
  The following columns are being merged:
  
  =======  ===  ====
  \        HS   freq
  =======  ===  ====
  Table 1  HS   freq
  Table 2  HS       
  Table 3  HS   freq
  =======  ===  ====
  
                                                
  Performing merge: 1/2 
                                                
  Performing merge: 2/2 
                                                
  Merge complete
  Identifying columns to merge
  No merging keys were found. Will try merging all columns with matching names!
  Data type for variable HS differ across tables - converting to character
  The following columns are being merged:
  
  =======  ===
  \        HS 
  =======  ===
  Table 1  HS 
  Table 2  HS 
  =======  ===
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  No merging keys were found. Will try merging all columns with matching names!
  Data type for variable HS differ across tables - converting to character
  The following columns are being merged:
  
  =======  ===
  \        HS 
  =======  ===
  Table 1  HS 
  Table 2  HS 
  =======  ===
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  Table 1 - countries detected in column names, pivoting columns: France, Italy, US
  Table 2 - years detected in column names, pivoting columns: France1992, France1993, France1994
  Converting country names
  Checking time columns
  The following columns are being merged:
  
  =======  =======================  =====================
  \        country                  time                 
  =======  =======================  =====================
  Table 1  Table1_pivoted_colnames                       
  Table 2                           year_pivoted_colnames
  =======  =======================  =====================
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  Identifying columns to merge
  Table 2 - countries detected in column names, pivoting columns: France, Italy, US
  Converting country names
  No merging key found for Table 1. Data will be appended. 
  The following columns are being merged:
  
  =======  =======================
  \        country                
  =======  =======================
  Table 1                         
  Table 2  Table2_pivoted_colnames
  =======  =======================
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  Table 1 - countries detected in column names, pivoting columns: Japan, Norway, Germany, US
  Table 2 - countries detected in column names, pivoting columns: France, Italy, US
  Converting country names
  Checking time columns
  The following columns are being merged:
  
  =======  =======================  ====
  \        country                  time
  =======  =======================  ====
  Table 1  Table1_pivoted_colnames  Date
  Table 2  Table2_pivoted_colnames      
  =======  =======================  ====
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  Checking time columns
  No merging key found for Table 2. Data will be appended. 
  The following columns are being merged:
  
  =======  ====
  \        time
  =======  ====
  Table 1  Date
  Table 2      
  =======  ====
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  (Set merging_info to TRUE to save merging details)
  Identifying columns to merge
  Checking time columns
  No merging key found for Table 2. Data will be appended. 
  The following columns are being merged:
  
  =======  ====
  \        time
  =======  ====
  Table 1  Date
  Table 2      
  =======  ====
  
                                                
  Performing merge: 1/1 
                                                
  Merge complete
  countries detected in column names, pivoting columns: France, Italy, US
  countries detected in column names, pivoting columns: France, Italy, US
  countries detected in column names, pivoting columns: France, Italy, US
  countries detected in column names, pivoting columns: France, Italy, US
  countries detected in column names, pivoting columns: France, Italy, US
  countries detected in column names, pivoting columns: France, Italy, US
  countries detected in column names, pivoting columns: France, Italy, US
  countries detected in column names, pivoting columns: France, Italy, US
  No column was pivoted
  No column was pivoted
  No column was pivoted
  year detected in column names, pivoting columns: France1992, France1993, France1994
  year detected in column names, pivoting columns: France1992, France1993, France1994
  year detected in column names, pivoting columns: France1992, France1993, France1994
  year detected in column names, pivoting columns: France1992, France1993, France1994
  Saving _problems/test_function_output-251.R
  Saving _problems/test_function_output-260.R
  [ FAIL 2 | WARN 0 | SKIP 0 | PASS 146 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test_function_output.R:251:5'): output from list_fields() are as expected ──
  Error in `(function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, fix.empty.names = TRUE, stringsAsFactors = FALSE)  {     data.row.names <- if (check.rows && is.null(row.names))          function(current, new, i) {             if (is.character(current))                  new <- as.character(new)             if (is.character(new))                  current <- as.character(current)             if (anyDuplicated(new))                  return(current)             if (is.null(current))                  return(new)             if (all(current == new) || all(current == ""))                  return(new)             stop(gettextf("mismatch of row names in arguments of 'data.frame', item %d", i), domain = NA)         }     else function(current, new, i) {         current %||% if (anyDuplicated(new)) {             warning(gettextf("some row.names duplicated: %s --> row.names NOT used", paste(which(duplicated(new)), collapse = ",")), domain = NA)             current         }         else new     }     object <- as.list(substitute(list(...)))[-1L]     mirn <- missing(row.names)     mrn <- is.null(row.names)     fixRN <- function(rownms) {         if (is.object(rownms) || !is.integer(rownms))              rownms <- as.character(rownms)         if (anyNA(rownms))              stop("row names contain missing values")         if (anyDuplicated(rownms))              stop(gettextf("duplicate row.names: %s", paste(unique(rownms[duplicated(rownms)]), collapse = ", ")), domain = NA)         rownms     }     x <- list(...)     n <- length(x)     if (n < 1L) {         row.names <- if (!mrn)              fixRN(row.names)         else integer()         return(structure(list(), names = character(), row.names = row.names, class = "data.frame"))     }     vnames <- names(x)     if (length(vnames) != n)          vnames <- character(n)     no.vn <- !nzchar(vnames)     vlist <- vnames <- as.list(vnames)     nrows <- ncols <- integer(n)     for (i in seq_len(n)) {         xi <- if (is.character(x[[i]]) || is.list(x[[i]]))              as.data.frame(x[[i]], optional = TRUE, validRN = FALSE, stringsAsFactors = stringsAsFactors)         else as.data.frame(x[[i]], optional = TRUE, validRN = FALSE)         nrows[i] <- .row_names_info(xi)         ncols[i] <- length(xi)         namesi <- names(xi)         if (ncols[i] > 1L) {             if (length(namesi) == 0L)                  namesi <- seq_len(ncols[i])             vnames[[i]] <- if (no.vn[i])                  namesi             else paste(vnames[[i]], namesi, sep = ".")         }         else if (length(namesi)) {             vnames[[i]] <- namesi         }         else if (fix.empty.names && no.vn[[i]]) {             tmpname <- deparse(object[[i]], nlines = 1L)[1L]             if (startsWith(tmpname, "I(") && endsWith(tmpname, ")")) {                 ntmpn <- nchar(tmpname, "c")                 tmpname <- substr(tmpname, 3L, ntmpn - 1L)             }             vnames[[i]] <- tmpname         }         if (mirn && nrows[i] > 0L) {             rowsi <- attr(xi, "row.names")             if (any(nzchar(rowsi)))                  row.names <- data.row.names(row.names, rowsi, i)         }         nrows[i] <- abs(nrows[i])         vlist[[i]] <- xi     }     nr <- max(nrows)     for (i in seq_len(n)[nrows < nr]) {         xi <- vlist[[i]]         if (nrows[i] > 0L && (nr%%nrows[i] == 0L)) {             xi <- unclass(xi)             fixed <- TRUE             for (j in seq_along(xi)) {                 xi1 <- xi[[j]]                 if (is.vector(xi1) || is.factor(xi1))                    xi[[j]] <- rep(xi1, length.out = nr)                 else if (is.character(xi1) && inherits(xi1, "AsIs"))                    xi[[j]] <- structure(rep(xi1, length.out = nr), class = class(xi1))                 else if (inherits(xi1, "Date") || inherits(xi1, "POSIXct"))                    xi[[j]] <- rep(xi1, length.out = nr)                 else {                   fixed <- FALSE                   break                 }             }             if (fixed) {                 vlist[[i]] <- xi                 next             }         }         stop(gettextf("arguments imply differing number of rows: %s", paste(unique(nrows), collapse = ", ")), domain = NA)     }     value <- unlist(vlist, recursive = FALSE, use.names = FALSE)     vnames <- as.character(unlist(vnames[ncols > 0L]))     if (fix.empty.names && any(noname <- !nzchar(vnames)))          vnames[noname] <- paste0("Var.", seq_along(vnames))[noname]     if (check.names) {         if (fix.empty.names)              vnames <- make.names(vnames, unique = TRUE)         else {             nz <- nzchar(vnames)             vnames[nz] <- make.names(vnames[nz], unique = TRUE)         }     }     names(value) <- vnames     if (!mrn) {         if (length(row.names) == 1L && nr != 1L) {             if (is.character(row.names))                  row.names <- match(row.names, vnames, 0L)             if (length(row.names) != 1L || row.names < 1L || row.names > length(vnames))                  stop("'row.names' should specify one of the variables")             i <- row.names             row.names <- value[[i]]             value <- value[-i]         }         else if (!is.null(row.names) && length(row.names) != nr)              stop("row names supplied are of the wrong length")     }     else if (!is.null(row.names) && length(row.names) != nr) {         warning("row names were found from a short variable and have been discarded")         row.names <- NULL     }     class(value) <- "data.frame"     if (is.null(row.names))          attr(value, "row.names") <- .set_row_names(nr)     else {         row.names(value) <- fixRN(row.names)     }     value })(success = FALSE, data = NULL, errors = structure(list(message = "This API version has been deprecated. Please visit the https://restcountries.com/docs/legacy-api-deprecation to migrate to our new version (v5)."), class = "data.frame", row.names = 1L), check.names = TRUE, fix.empty.names = TRUE, stringsAsFactors = FALSE)`: arguments imply differing number of rows: 1, 0
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(length(list_fields()) > 0, TRUE) at test_function_output.R:251:5
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─countries::list_fields()
   5.   └─countries::country_info()
   6.     ├─base::as.data.frame(data)
   7.     └─base::as.data.frame.list(data)
   8.       ├─base::do.call(data.frame, c(x, alis))
   9.       └─base (local) `<fn>`(...)
  ── Error ('test_function_output.R:260:5'): output from country_info() are as expected ──
  Error in `(function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, fix.empty.names = TRUE, stringsAsFactors = FALSE)  {     data.row.names <- if (check.rows && is.null(row.names))          function(current, new, i) {             if (is.character(current))                  new <- as.character(new)             if (is.character(new))                  current <- as.character(current)             if (anyDuplicated(new))                  return(current)             if (is.null(current))                  return(new)             if (all(current == new) || all(current == ""))                  return(new)             stop(gettextf("mismatch of row names in arguments of 'data.frame', item %d", i), domain = NA)         }     else function(current, new, i) {         current %||% if (anyDuplicated(new)) {             warning(gettextf("some row.names duplicated: %s --> row.names NOT used", paste(which(duplicated(new)), collapse = ",")), domain = NA)             current         }         else new     }     object <- as.list(substitute(list(...)))[-1L]     mirn <- missing(row.names)     mrn <- is.null(row.names)     fixRN <- function(rownms) {         if (is.object(rownms) || !is.integer(rownms))              rownms <- as.character(rownms)         if (anyNA(rownms))              stop("row names contain missing values")         if (anyDuplicated(rownms))              stop(gettextf("duplicate row.names: %s", paste(unique(rownms[duplicated(rownms)]), collapse = ", ")), domain = NA)         rownms     }     x <- list(...)     n <- length(x)     if (n < 1L) {         row.names <- if (!mrn)              fixRN(row.names)         else integer()         return(structure(list(), names = character(), row.names = row.names, class = "data.frame"))     }     vnames <- names(x)     if (length(vnames) != n)          vnames <- character(n)     no.vn <- !nzchar(vnames)     vlist <- vnames <- as.list(vnames)     nrows <- ncols <- integer(n)     for (i in seq_len(n)) {         xi <- if (is.character(x[[i]]) || is.list(x[[i]]))              as.data.frame(x[[i]], optional = TRUE, validRN = FALSE, stringsAsFactors = stringsAsFactors)         else as.data.frame(x[[i]], optional = TRUE, validRN = FALSE)         nrows[i] <- .row_names_info(xi)         ncols[i] <- length(xi)         namesi <- names(xi)         if (ncols[i] > 1L) {             if (length(namesi) == 0L)                  namesi <- seq_len(ncols[i])             vnames[[i]] <- if (no.vn[i])                  namesi             else paste(vnames[[i]], namesi, sep = ".")         }         else if (length(namesi)) {             vnames[[i]] <- namesi         }         else if (fix.empty.names && no.vn[[i]]) {             tmpname <- deparse(object[[i]], nlines = 1L)[1L]             if (startsWith(tmpname, "I(") && endsWith(tmpname, ")")) {                 ntmpn <- nchar(tmpname, "c")                 tmpname <- substr(tmpname, 3L, ntmpn - 1L)             }             vnames[[i]] <- tmpname         }         if (mirn && nrows[i] > 0L) {             rowsi <- attr(xi, "row.names")             if (any(nzchar(rowsi)))                  row.names <- data.row.names(row.names, rowsi, i)         }         nrows[i] <- abs(nrows[i])         vlist[[i]] <- xi     }     nr <- max(nrows)     for (i in seq_len(n)[nrows < nr]) {         xi <- vlist[[i]]         if (nrows[i] > 0L && (nr%%nrows[i] == 0L)) {             xi <- unclass(xi)             fixed <- TRUE             for (j in seq_along(xi)) {                 xi1 <- xi[[j]]                 if (is.vector(xi1) || is.factor(xi1))                    xi[[j]] <- rep(xi1, length.out = nr)                 else if (is.character(xi1) && inherits(xi1, "AsIs"))                    xi[[j]] <- structure(rep(xi1, length.out = nr), class = class(xi1))                 else if (inherits(xi1, "Date") || inherits(xi1, "POSIXct"))                    xi[[j]] <- rep(xi1, length.out = nr)                 else {                   fixed <- FALSE                   break                 }             }             if (fixed) {                 vlist[[i]] <- xi                 next             }         }         stop(gettextf("arguments imply differing number of rows: %s", paste(unique(nrows), collapse = ", ")), domain = NA)     }     value <- unlist(vlist, recursive = FALSE, use.names = FALSE)     vnames <- as.character(unlist(vnames[ncols > 0L]))     if (fix.empty.names && any(noname <- !nzchar(vnames)))          vnames[noname] <- paste0("Var.", seq_along(vnames))[noname]     if (check.names) {         if (fix.empty.names)              vnames <- make.names(vnames, unique = TRUE)         else {             nz <- nzchar(vnames)             vnames[nz] <- make.names(vnames[nz], unique = TRUE)         }     }     names(value) <- vnames     if (!mrn) {         if (length(row.names) == 1L && nr != 1L) {             if (is.character(row.names))                  row.names <- match(row.names, vnames, 0L)             if (length(row.names) != 1L || row.names < 1L || row.names > length(vnames))                  stop("'row.names' should specify one of the variables")             i <- row.names             row.names <- value[[i]]             value <- value[-i]         }         else if (!is.null(row.names) && length(row.names) != nr)              stop("row names supplied are of the wrong length")     }     else if (!is.null(row.names) && length(row.names) != nr) {         warning("row names were found from a short variable and have been discarded")         row.names <- NULL     }     class(value) <- "data.frame"     if (is.null(row.names))          attr(value, "row.names") <- .set_row_names(nr)     else {         row.names(value) <- fixRN(row.names)     }     value })(success = FALSE, data = NULL, errors = structure(list(message = "This API version has been deprecated. Please visit the https://restcountries.com/docs/legacy-api-deprecation to migrate to our new version (v5)."), class = "data.frame", row.names = 1L), check.names = TRUE, fix.empty.names = TRUE, stringsAsFactors = FALSE)`: arguments imply differing number of rows: 1, 0
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test_function_output.R:260:5
   2. │ └─testthat::quasi_label(enquo(object), label)
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. ├─base::is.data.frame(country_info("USA", "capital"))
   5. └─countries::country_info("USA", "capital")
   6.   ├─base::as.data.frame(data)
   7.   └─base::as.data.frame.list(data)
   8.     ├─base::do.call(data.frame, c(x, alis))
   9.     └─base (local) `<fn>`(...)
  
  [ FAIL 2 | WARN 0 | SKIP 0 | PASS 146 ]
  Error:
  ! Test failures.
  Execution halted