Running ‘testthat.R’ [2s/3s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(rtk)
  > 
  > test_check("rtk")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  rtk
   --- call from context --- 
  rtk(data, depth = min(a), ReturnMatrix = 1, margin = 2, verbose = F)
   --- call from argument --- 
  if (class(input) == "data.frame") {
      input <- as.matrix(input)
  }
   --- R stacktrace ---
  where 1: rtk(data, depth = min(a), ReturnMatrix = 1, margin = 2, verbose = F)
  where 2: is.data.frame(x)
  where 3: colSums(rtk(data, depth = min(a), ReturnMatrix = 1, margin = 2, 
      verbose = F)$raremat[[1]])
  where 4: eval_bare(expr, quo_get_env(quo))
  where 5: quasi_label(enquo(object), label, arg = "object")
  where 6 at testthat/test_rare.R#10: expect_equal(colSums(rtk(data, depth = min(a), ReturnMatrix = 1, 
      margin = 2, verbose = F)$raremat[[1]]), a)
  where 7: eval(code, test_env)
  where 8: eval(code, test_env)
  where 9: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 10: doTryCatch(return(expr), name, parentenv, handler)
  where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 13: doTryCatch(return(expr), name, parentenv, handler)
  where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 15: tryCatchList(expr, classes, parentenv, handlers)
  where 16: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 17: test_code(desc, code, env = parent.frame())
  where 18 at testthat/test_rare.R#5: test_that("rare works on columns and rows", {
      data <- matrix(c(10, 0, 5, 2, 3, 4, 0, 4, 5, 2, 4, 10, 3, 
          0, 0, 2, 3, 5, 10, 0, 0, 5, 19, 20, 0, 4, 5), 3)
      a <- rep(min(colSums(data)), ncol(data))
      b <- rep(min(rowSums(data)), nrow(data))
      expect_equal(colSums(rtk(data, depth = min(a), ReturnMatrix = 1, 
          margin = 2, verbose = F)$raremat[[1]]), a)
      expect_equal(rowSums(rtk(data, depth = min(b), ReturnMatrix = 1, 
          margin = 1, verbose = F)$raremat[[1]]), b)
  })
  where 19: eval(code, test_env)
  where 20: eval(code, test_env)
  where 21: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 22: doTryCatch(return(expr), name, parentenv, handler)
  where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 25: doTryCatch(return(expr), name, parentenv, handler)
  where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 27: tryCatchList(expr, classes, parentenv, handlers)
  where 28: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 29: test_code(NULL, exprs, env)
  where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 31: force(code)
  where 32: doWithOneRestart(return(expr), restart)
  where 33: withOneRestart(expr, restarts[[1L]])
  where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 36: FUN(X[[i]], ...)
  where 37: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 38: force(code)
  where 39: doWithOneRestart(return(expr), restart)
  where 40: withOneRestart(expr, restarts[[1L]])
  where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 42: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 45: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 46: test_check("rtk")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (input, repeats = 10, depth = 1000, ReturnMatrix = 0, 
      margin = 2, verbose = FALSE, threads = 1, tmpdir = NULL) 
  {
      removeCnames <- FALSE
      removeRnames <- FALSE
      if (repeats < ReturnMatrix) {
          repeats <- ReturnMatrix
          warning(paste("Repeats can not be smaller than number of matrices to return. Repeats set to match ReturnMatrix. repeats = ReturnMatrix =", 
              repeats, sep = " "))
      }
      depth <- sort(as.numeric(depth))
      if (class(input) == "data.frame") {
          input <- as.matrix(input)
      }
      if (class(input) == "matrix") {
          rare.status("Matrix object supplied for analysis", verbose)
          if (!is.numeric(input)) {
              stop("The supplied matrix object is not numeric. Please check your input matrix.")
          }
          if (any(is.na(input))) {
              stop("The input data contains NA values. Please sanitize your input first.")
          }
          if (is.null(colnames(input))) {
              colnames(input) <- paste("col ", seq(1:ncol(input)), 
                  sep = "")
              removeCnames <- TRUE
          }
          if (is.null(rownames(input))) {
              rownames(input) <- paste("row ", seq(1:nrow(input)), 
                  sep = "")
              removeRnames <- TRUE
          }
          result <- rcpp_rarefaction("", input, colnames(input), 
              rownames(input), repeats, depth, ReturnMatrix, verbose, 
              threads, margin, "NULL", FALSE)
          gc()
      }
      else if (class(input) == "character") {
          rare.status("A path to a matrix file was supplied", verbose)
          if (!is.null(tmpdir) & margin == 2) {
              uselowmem <- TRUE
              rare.status("Low memory mode will be used. Temporary files will be stored on storage medium", 
                  verbose)
          }
          else if (!is.null(tmpdir) & margin != 2) {
              warning("Can not use low mem on margin = 1. Please consider transforming your input data, to use low memory (swap) mode.")
          }
          else {
              uselowmem <- FALSE
              tmpdir <- "NULL"
          }
          if (!file.exists(input)) {
              stop(paste("The file can not be found. Please verify that the file exists in the given location. The path given is:", 
                  input, sep = " "))
          }
          result <- rcpp_rarefaction(input, matrix(1, 1, c(1)), 
              c(NA), c(NA), repeats, depth, ReturnMatrix, verbose, 
              threads, margin, tmpdir, uselowmem)
      }
      else {
          stop("Unknown input type. Path to a file (character) or a numeric matrix are accepted types.")
      }
      result <- lapply(result, function(res) {
          if (removeRnames == TRUE && removeCnames == TRUE) {
              res$raremat <- lapply(res$raremat, unname)
          }
          else {
              if (removeRnames == TRUE) {
                  res$raremat <- lapply(res$raremat, function(x) {
                    rownames(x) <- NULL
                    return(x)
                  })
              }
              if (removeCnames == TRUE) {
                  res$raremat <- lapply(res$raremat, function(x) {
                    colnames(x) <- NULL
                    return(x)
                  })
              }
          }
          if (length(res$skipped) > 0) {
              warning(paste(length(res$skipped), "samples where skipped because the depth was greater than the number of elements in the sample."))
          }
          measures <- c("richness", "shannon", "simpson", "invsimpson", 
              "chao1", "eveness")
          res$div.median <- lapply(measures, r.median, x = res$divvs)
          names(res$div.median) <- paste("median.", measures, sep = "")
          return(res)
      })
      if (length(depth) == 1) {
          result <- result[[1]]
      }
      else {
          names(result) <- depth
      }
      result$depths <- depth
      result$repeats <- repeats
      class(result) <- "rtk"
      gc()
      return(result)
  }
  <bytecode: 0x563cc50f9b48>
  <environment: namespace:rtk>
   --- function search by body ---
  Function rtk in namespace rtk has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1