Running 'testthat.R' [29s/32s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library("testthat")
  > library("adjclust")
  > 
  > test_check("adjclust")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  adjclust
   --- call from context --- 
  matR(mat, h)
   --- call from argument --- 
  if (class(mat) == "dgCMatrix") mat <- t(mat)
   --- R stacktrace ---
  where 1: matR(mat, h)
  where 2: run.adjclust(mat, type = type, h = h)
  where 3: adjClust.matrix(sim * 2/9)
  where 4 at testthat/test_adjclust_equivalentTo_hclust.R#16: adjClust(sim * 2/9)
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: 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 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test_adjclust_equivalentTo_hclust.R#6: test_that("'hclust' and 'adjClust' give identical results on toy data when the\n          best merges are always adjacent merges", 
      {
          data("iris")
          dissim <- dist(iris[1:10, 1:4])^2
          fit0 <- hclust(dissim, method = "ward.D")
          dissim <- as.dist(as.matrix(dissim)[fit0$order, fit0$order])
          fit1 <- hclust(dissim/9, method = "ward.D")
          sim <- 1 - as.matrix(dissim)/2
          fit2 <- adjClust(sim * 2/9)
          expect_equal(fit1$height, fit2$height, tolerance = 1e-05)
          expect_equal(fit1$merge, fit2$merge)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: 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 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: 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 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: 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 43: 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 44: test_check("adjclust")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (mat, h) 
  {
      if (class(mat) == "dgCMatrix") 
          mat <- t(mat)
      p <- ncol(mat)
      x <- rep(p:1, each = h + 1)
      y <- x - rep(0:h, p)
      coord <- cbind(x, y)
      out <- rep(0, p * (h + 1))
      out[y >= 1] <- mat[coord[y >= 1, ]]
      out <- matrix(out, ncol = h + 1, byrow = TRUE)
      out[, -1] <- 2 * out[, -1]
      return(out)
  }
  <bytecode: 0x9b9ad48>
  <environment: namespace:adjclust>
   --- function search by body ---
  Function matR in namespace adjclust has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 1. Error: 'hclust' and 'adjClust' give identical results on toy data when the
  the condition has length > 1
  Backtrace:
   1. adjclust::adjClust(sim * 2/9)
   2. adjclust:::adjClust.matrix(sim * 2/9)
   3. adjclust:::run.adjclust(mat, type = type, h = h)
   4. adjclust:::matR(mat, h)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  adjclust
   --- call from context --- 
  matR(mat, h)
   --- call from argument --- 
  if (class(mat) == "dgCMatrix") mat <- t(mat)
   --- R stacktrace ---
  where 1: matR(mat, h)
  where 2: run.adjclust(mat, type = type, h = h)
  where 3: adjClust.matrix(sim, "similarity", p - 1)
  where 4 at testthat/test_adjclust_equivalentTo_rioja.R#24: adjClust(sim, "similarity", p - 1)
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: 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 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test_adjclust_equivalentTo_rioja.R#11: test_that("rioja and adjClust with full band give identical results on toy data", 
      {
          check_rioja()
          data("iris")
          sim <- cor(t(iris[, 1:4]))
          p <- nrow(sim)
          dis_sq <- 2 - (2 * sim)
          dis <- sqrt(dis_sq)
          dis_sq <- as.dist(dis_sq)
          dis <- as.dist(dis)
          fit1 <- adjClust(sim, "similarity", p - 1)
          fit2 <- chclust(dis_sq, method = "coniss")
          fit3 <- adjClust(dis, "dissimilarity", p - 1)
          fit4 <- adjClust(sim, "similarity")
          expect_equal(fit1$merge, fit2$merge)
          expect_equal(cumsum(fit1$height), fit2$height, tolerance = 1e-05)
          expect_equal(fit3$merge, fit2$merge)
          expect_equal(cumsum(fit3$height), fit2$height, tolerance = 1e-05)
          expect_equal(fit4$merge, fit2$merge)
          expect_equal(cumsum(fit4$height), fit2$height, tolerance = 1e-05)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: 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 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: 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 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: 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 43: 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 44: test_check("adjclust")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (mat, h) 
  {
      if (class(mat) == "dgCMatrix") 
          mat <- t(mat)
      p <- ncol(mat)
      x <- rep(p:1, each = h + 1)
      y <- x - rep(0:h, p)
      coord <- cbind(x, y)
      out <- rep(0, p * (h + 1))
      out[y >= 1] <- mat[coord[y >= 1, ]]
      out <- matrix(out, ncol = h + 1, byrow = TRUE)
      out[, -1] <- 2 * out[, -1]
      return(out)
  }
  <bytecode: 0x9b9ad48>
  <environment: namespace:adjclust>
   --- function search by body ---
  Function matR in namespace adjclust has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 2. Error: rioja and adjClust with full band give identical results on toy dat
  the condition has length > 1
  Backtrace:
   1. adjclust::adjClust(sim, "similarity", p - 1)
   2. adjclust:::adjClust.matrix(sim, "similarity", p - 1)
   3. adjclust:::run.adjclust(mat, type = type, h = h)
   4. adjclust:::matR(mat, h)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  adjclust
   --- call from context --- 
  matR(mat, h)
   --- call from argument --- 
  if (class(mat) == "dgCMatrix") mat <- t(mat)
   --- R stacktrace ---
  where 1: matR(mat, h)
  where 2: run.adjclust(mat, type = type, h = h)
  where 3: adjClust.matrix(sim)
  where 4 at testthat/test_correct.R#9: adjClust(sim)
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: 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 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test_correct.R#5: test_that("'diagnose' and 'correct' must return a warning or a message when no reversals are found.", 
      {
          data("iris")
          dissim <- dist(iris[, 1:4])^2
          sim <- 1 - as.matrix(dissim)/2
          fit <- adjClust(sim)
          fit2 <- correct(fit)
          expect_equal(sum(diff(fit2$height) < 0), 0)
          expect_warning(correct(fit2))
          expect_message(diagnose(fit2))
          expect_null(suppressWarnings(correct(fit2)))
          expect_null(diagnose(fit2))
          corrected_dendro <- as.hclust(plot(fit, mode = "corrected"))
          expect_equal(corrected_dendro$height, fit2$height)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: 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 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: 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 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: 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 43: 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 44: test_check("adjclust")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (mat, h) 
  {
      if (class(mat) == "dgCMatrix") 
          mat <- t(mat)
      p <- ncol(mat)
      x <- rep(p:1, each = h + 1)
      y <- x - rep(0:h, p)
      coord <- cbind(x, y)
      out <- rep(0, p * (h + 1))
      out[y >= 1] <- mat[coord[y >= 1, ]]
      out <- matrix(out, ncol = h + 1, byrow = TRUE)
      out[, -1] <- 2 * out[, -1]
      return(out)
  }
  <bytecode: 0x9b9ad48>
  <environment: namespace:adjclust>
   --- function search by body ---
  Function matR in namespace adjclust has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 3. Error: 'diagnose' and 'correct' must return a warning or a message when no
  the condition has length > 1
  Backtrace:
   1. adjclust::adjClust(sim)
   2. adjclust:::adjClust.matrix(sim)
   3. adjclust:::run.adjclust(mat, type = type, h = h)
   4. adjclust:::matR(mat, h)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  adjclust
   --- call from context --- 
  matR(mat, h)
   --- call from argument --- 
  if (class(mat) == "dgCMatrix") mat <- t(mat)
   --- R stacktrace ---
  where 1: matR(mat, h)
  where 2: run.adjclust(mat, type = type, h = h)
  where 3: adjClust.matrix(sim)
  where 4 at testthat/test_corrected_plot.R#10: adjClust(sim)
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: 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 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test_corrected_plot.R#5: test_that("'adjClust' returns a dendrogram with increasing heights for \n          'mode=corrected'", 
      {
          data("iris")
          dissim <- dist(iris[, 1:4])^2
          sim <- 1 - as.matrix(dissim)/2
          fit <- adjClust(sim)
          corrected_dendo <- as.hclust(plot(fit, mode = "corrected"))
          expect_equal(sum(diff(corrected_dendo$height) < 0), 0)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: 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 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: 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 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: 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 43: 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 44: test_check("adjclust")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (mat, h) 
  {
      if (class(mat) == "dgCMatrix") 
          mat <- t(mat)
      p <- ncol(mat)
      x <- rep(p:1, each = h + 1)
      y <- x - rep(0:h, p)
      coord <- cbind(x, y)
      out <- rep(0, p * (h + 1))
      out[y >= 1] <- mat[coord[y >= 1, ]]
      out <- matrix(out, ncol = h + 1, byrow = TRUE)
      out[, -1] <- 2 * out[, -1]
      return(out)
  }
  <bytecode: 0x9b9ad48>
  <environment: namespace:adjclust>
   --- function search by body ---
  Function matR in namespace adjclust has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 4. Error: 'adjClust' returns a dendrogram with increasing heights for 
        
  the condition has length > 1
  Backtrace:
   1. adjclust::adjClust(sim)
   2. adjclust:::adjClust.matrix(sim)
   3. adjclust:::run.adjclust(mat, type = type, h = h)
   4. adjclust:::matR(mat, h)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  adjclust
   --- call from context --- 
  matR(mat, h)
   --- call from argument --- 
  if (class(mat) == "dgCMatrix") mat <- t(mat)
   --- R stacktrace ---
  where 1: matR(mat, h)
  where 2: run.adjclust(mat, type = type, h = h)
  where 3: adjClust.matrix(sim)
  where 4 at testthat/test_cuttree.R#10: adjClust(sim)
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: 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 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test_cuttree.R#6: test_that("'cuttree' must ignore 'h' when reversals are present.", 
      {
          data("iris")
          dissim <- dist(iris[, 1:4])^2
          sim <- 1 - as.matrix(dissim)/2
          fit <- adjClust(sim)
          fit2 <- correct(fit)
          clust1 <- cutree(fit, k = 4)
          expect_error(cutree(fit, h = 0.02))
          clust2 <- cutree(fit, k = 4, h = 50)
          expect_equal(clust1, clust2)
          clust3 <- cutree(fit2, k = 4)
          expect_equal(clust1, clust3)
          height4four <- (fit2$height[nrow(sim) - 3] + fit2$height[nrow(sim) - 
              4])/2
          clust4 <- cutree(fit2, h = height4four)
          expect_equal(clust1, clust4)
          clust5 <- cutree(fit2, k = 4, h = 50)
          expect_equal(clust1, clust5)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: 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 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: 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 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: 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 43: 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 44: test_check("adjclust")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (mat, h) 
  {
      if (class(mat) == "dgCMatrix") 
          mat <- t(mat)
      p <- ncol(mat)
      x <- rep(p:1, each = h + 1)
      y <- x - rep(0:h, p)
      coord <- cbind(x, y)
      out <- rep(0, p * (h + 1))
      out[y >= 1] <- mat[coord[y >= 1, ]]
      out <- matrix(out, ncol = h + 1, byrow = TRUE)
      out[, -1] <- 2 * out[, -1]
      return(out)
  }
  <bytecode: 0x9b9ad48>
  <environment: namespace:adjclust>
   --- function search by body ---
  Function matR in namespace adjclust has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 5. Error: 'cuttree' must ignore 'h' when reversals are present. (@test_cuttre
  the condition has length > 1
  Backtrace:
   1. adjclust::adjClust(sim)
   2. adjclust:::adjClust.matrix(sim)
   3. adjclust:::run.adjclust(mat, type = type, h = h)
   4. adjclust:::matR(mat, h)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  adjclust
   --- call from context --- 
  matR(mat, h)
   --- call from argument --- 
  if (class(mat) == "dgCMatrix") mat <- t(mat)
   --- R stacktrace ---
  where 1: matR(mat, h)
  where 2: run.adjclust(mat, type = type, h = h)
  where 3: adjClust.matrix(mat, h = 2)
  where 4 at testthat/test_dense_sparse_comparison.R#15: adjClust(mat, h = 2)
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: 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 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test_dense_sparse_comparison.R#14: test_that("test that adjClust gives identical results for sparse and dense matrices when h < p-1", 
      {
          fit1 <- adjClust(mat, h = 2)
          fit2 <- adjClust(smat1, h = 2)
          fit3 <- adjClust(smat2, h = 2)
          fit4 <- adjClust(smat3, h = 2)
          fit5 <- adjClust(smat4, h = 2)
          expect_equal(fit1$merge, fit2$merge)
          expect_equal(fit1$height, fit2$height)
          expect_equal(fit1$merge, fit3$merge)
          expect_equal(fit1$height, fit3$height)
          expect_equal(fit1$merge, fit4$merge)
          expect_equal(fit1$height, fit4$height)
          expect_equal(fit1$merge, fit5$merge)
          expect_equal(fit1$height, fit5$height)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: 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 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: 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 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: 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 43: 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 44: test_check("adjclust")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (mat, h) 
  {
      if (class(mat) == "dgCMatrix") 
          mat <- t(mat)
      p <- ncol(mat)
      x <- rep(p:1, each = h + 1)
      y <- x - rep(0:h, p)
      coord <- cbind(x, y)
      out <- rep(0, p * (h + 1))
      out[y >= 1] <- mat[coord[y >= 1, ]]
      out <- matrix(out, ncol = h + 1, byrow = TRUE)
      out[, -1] <- 2 * out[, -1]
      return(out)
  }
  <bytecode: 0x9b9ad48>
  <environment: namespace:adjclust>
   --- function search by body ---
  Function matR in namespace adjclust has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 6. Error: test that adjClust gives identical results for sparse and dense mat
  the condition has length > 1
  Backtrace:
   1. adjclust::adjClust(mat, h = 2)
   2. adjclust:::adjClust.matrix(mat, h = 2)
   3. adjclust:::run.adjclust(mat, type = type, h = h)
   4. adjclust:::matR(mat, h)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  adjclust
   --- call from context --- 
  matR(mat, h)
   --- call from argument --- 
  if (class(mat) == "dgCMatrix") mat <- t(mat)
   --- R stacktrace ---
  where 1: matR(mat, h)
  where 2: run.adjclust(mat, type = type, h = h)
  where 3: adjClust.matrix(mat)
  where 4 at testthat/test_dense_sparse_comparison.R#35: adjClust(mat)
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: 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 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test_dense_sparse_comparison.R#34: test_that("test that adjClust gives identical results for sparse and dense matrices when h is p-1", 
      {
          fit1 <- adjClust(mat)
          fit2 <- adjClust(smat1)
          fit3 <- adjClust(smat2)
          fit4 <- adjClust(smat3)
          fit5 <- adjClust(smat4)
          expect_equal(fit1$merge, fit2$merge)
          expect_equal(fit1$height, fit2$height)
          expect_equal(fit1$merge, fit3$merge)
          expect_equal(fit1$height, fit3$height)
          expect_equal(fit1$merge, fit4$merge)
          expect_equal(fit1$height, fit4$height)
          expect_equal(fit1$merge, fit5$merge)
          expect_equal(fit1$height, fit5$height)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: 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 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: 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 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: 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 43: 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 44: test_check("adjclust")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (mat, h) 
  {
      if (class(mat) == "dgCMatrix") 
          mat <- t(mat)
      p <- ncol(mat)
      x <- rep(p:1, each = h + 1)
      y <- x - rep(0:h, p)
      coord <- cbind(x, y)
      out <- rep(0, p * (h + 1))
      out[y >= 1] <- mat[coord[y >= 1, ]]
      out <- matrix(out, ncol = h + 1, byrow = TRUE)
      out[, -1] <- 2 * out[, -1]
      return(out)
  }
  <bytecode: 0x9b9ad48>
  <environment: namespace:adjclust>
   --- function search by body ---
  Function matR in namespace adjclust has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 7. Error: test that adjClust gives identical results for sparse and dense mat
  the condition has length > 1
  Backtrace:
   1. adjclust::adjClust(mat)
   2. adjclust:::adjClust.matrix(mat)
   3. adjclust:::run.adjclust(mat, type = type, h = h)
   4. adjclust:::matR(mat, h)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  adjclust
   --- call from context --- 
  matR(mat, h)
   --- call from argument --- 
  if (class(mat) == "dgCMatrix") mat <- t(mat)
   --- R stacktrace ---
  where 1: matR(mat, h)
  where 2: run.adjclust(mat, type = type, h = h)
  where 3: adjClust.matrix(sim)
  where 4 at testthat/test_final_height.R#10: adjClust(sim)
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: 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 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test_final_height.R#5: test_that("'adjClust' returns an object for which the sum of heights is the \n          dataset (pseudo) inertia", 
      {
          data("iris")
          dissim <- dist(iris[, 1:4])^2
          sim <- 1 - as.matrix(dissim)/2
          fit <- adjClust(sim)
          expect_equal(sum(fit$height), sum(dissim)/nrow(sim), 
              tolerance = 1e-05)
          inertia_dendo <- as.hclust(plot(fit, mode = "within-disp"))
          expect_equal(inertia_dendo$height[nrow(sim) - 1], sum(dissim)/nrow(sim), 
              tolerance = 1e-05)
          dispersion_dendo <- as.hclust(plot(fit, mode = "total-disp"))
          expect_equal(dispersion_dendo$height[nrow(sim) - 1], 
              sum(dissim)/nrow(sim), tolerance = 1e-05)
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: 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 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: 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 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: 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 43: 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 44: test_check("adjclust")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (mat, h) 
  {
      if (class(mat) == "dgCMatrix") 
          mat <- t(mat)
      p <- ncol(mat)
      x <- rep(p:1, each = h + 1)
      y <- x - rep(0:h, p)
      coord <- cbind(x, y)
      out <- rep(0, p * (h + 1))
      out[y >= 1] <- mat[coord[y >= 1, ]]
      out <- matrix(out, ncol = h + 1, byrow = TRUE)
      out[, -1] <- 2 * out[, -1]
      return(out)
  }
  <bytecode: 0x9b9ad48>
  <environment: namespace:adjclust>
   --- function search by body ---
  Function matR in namespace adjclust has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 8. Error: 'adjClust' returns an object for which the sum of heights is the 
   
  the condition has length > 1
  Backtrace:
   1. adjclust::adjClust(sim)
   2. adjclust:::adjClust.matrix(sim)
   3. adjclust:::run.adjclust(mat, type = type, h = h)
   4. adjclust:::matR(mat, h)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  adjclust
   --- call from context --- 
  matR(mat, h)
   --- call from argument --- 
  if (class(mat) == "dgCMatrix") mat <- t(mat)
   --- R stacktrace ---
  where 1: matR(mat, h)
  where 2: run.adjclust(mat, type = type, h = h)
  where 3: adjClust.matrix(sim)
  where 4 at testthat/test_modify.R#10: adjClust(sim)
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: 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 15: test_code(NULL, exprs, env)
  where 16: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 17: force(code)
  where 18: doWithOneRestart(return(expr), restart)
  where 19: withOneRestart(expr, restarts[[1L]])
  where 20: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 21: 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 22: FUN(X[[i]], ...)
  where 23: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 24: force(code)
  where 25: doWithOneRestart(return(expr), restart)
  where 26: withOneRestart(expr, restarts[[1L]])
  where 27: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 28: 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 29: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 30: 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 31: 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 32: test_check("adjclust")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (mat, h) 
  {
      if (class(mat) == "dgCMatrix") 
          mat <- t(mat)
      p <- ncol(mat)
      x <- rep(p:1, each = h + 1)
      y <- x - rep(0:h, p)
      coord <- cbind(x, y)
      out <- rep(0, p * (h + 1))
      out[y >= 1] <- mat[coord[y >= 1, ]]
      out <- matrix(out, ncol = h + 1, byrow = TRUE)
      out[, -1] <- 2 * out[, -1]
      return(out)
  }
  <bytecode: 0x9b9ad48>
  <environment: namespace:adjclust>
   --- function search by body ---
  Function matR in namespace adjclust has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 9. Error: (unknown) (@test_modify.R#10)  ------------------------------------
  the condition has length > 1
  Backtrace:
   1. adjclust::adjClust(sim)
   2. adjclust:::adjClust.matrix(sim)
   3. adjclust:::run.adjclust(mat, type = type, h = h)
   4. adjclust:::matR(mat, h)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  adjclust
   --- call from context --- 
  matR(mat, h)
   --- call from argument --- 
  if (class(mat) == "dgCMatrix") mat <- t(mat)
   --- R stacktrace ---
  where 1: matR(mat, h)
  where 2: run.adjclust(mat, type = type, h = h)
  where 3: adjClust.matrix(sim)
  where 4 at testthat/test_similarity_equivalentTo_dissimilarity.R#8: adjClust(sim)
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: 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 15: test_code(NULL, exprs, env)
  where 16: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 17: force(code)
  where 18: doWithOneRestart(return(expr), restart)
  where 19: withOneRestart(expr, restarts[[1L]])
  where 20: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 21: 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 22: FUN(X[[i]], ...)
  where 23: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 24: force(code)
  where 25: doWithOneRestart(return(expr), restart)
  where 26: withOneRestart(expr, restarts[[1L]])
  where 27: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 28: 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 29: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 30: 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 31: 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 32: test_check("adjclust")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (mat, h) 
  {
      if (class(mat) == "dgCMatrix") 
          mat <- t(mat)
      p <- ncol(mat)
      x <- rep(p:1, each = h + 1)
      y <- x - rep(0:h, p)
      coord <- cbind(x, y)
      out <- rep(0, p * (h + 1))
      out[y >= 1] <- mat[coord[y >= 1, ]]
      out <- matrix(out, ncol = h + 1, byrow = TRUE)
      out[, -1] <- 2 * out[, -1]
      return(out)
  }
  <bytecode: 0x9b9ad48>
  <environment: namespace:adjclust>
   --- function search by body ---
  Function matR in namespace adjclust has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 10. Error: (unknown) (@test_similarity_equivalentTo_dissimilarity.R#8)  -----
  the condition has length > 1
  Backtrace:
   1. adjclust::adjClust(sim)
   2. adjclust:::adjClust.matrix(sim)
   3. adjclust:::run.adjclust(mat, type = type, h = h)
   4. adjclust:::matR(mat, h)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  adjclust
   --- call from context --- 
  matR(mat, h)
   --- call from argument --- 
  if (class(mat) == "dgCMatrix") mat <- t(mat)
   --- R stacktrace ---
  where 1: matR(mat, h)
  where 2: run.adjclust(mat, type = type, h = h)
  where 3: adjClust.matrix(sim)
  where 4: adjClust(sim)
  where 5: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  where 6: withCallingHandlers(code, message = function(condition) {
      out$push(condition)
      maybe_restart("muffleMessage")
  })
  where 7: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)), 
      ...)
  where 8: quasi_capture(enquo(object), label, capture_messages)
  where 9 at testthat/test_warning_with_decreasing_height_plots.R#12: expect_message(fit <- adjClust(sim), "merges with non increasing heights")
  where 10: eval(code, test_env)
  where 11: eval(code, test_env)
  where 12: 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 13: doTryCatch(return(expr), name, parentenv, handler)
  where 14: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 15: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 16: doTryCatch(return(expr), name, parentenv, handler)
  where 17: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 18: tryCatchList(expr, classes, parentenv, handlers)
  where 19: 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 20: test_code(desc, code, env = parent.frame())
  where 21 at testthat/test_warning_with_decreasing_height_plots.R#6: test_that("'adjClust' returns a note when decreasing heights are produced and\n          warnings when such results are plotted with 'mode=standard' and\n          'mode=average-disp'", 
      {
          data("iris")
          dissim <- dist(iris[, 1:4])^2
          sim <- 1 - as.matrix(dissim)/2
          expect_message(fit <- adjClust(sim), "merges with non increasing heights")
          expect_warning(plot(fit))
          expect_warning(plot(fit, mode = "average-disp"))
      })
  where 22: eval(code, test_env)
  where 23: eval(code, test_env)
  where 24: 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 25: doTryCatch(return(expr), name, parentenv, handler)
  where 26: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 27: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 28: doTryCatch(return(expr), name, parentenv, handler)
  where 29: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 30: tryCatchList(expr, classes, parentenv, handlers)
  where 31: 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 32: test_code(NULL, exprs, env)
  where 33: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 34: force(code)
  where 35: doWithOneRestart(return(expr), restart)
  where 36: withOneRestart(expr, restarts[[1L]])
  where 37: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 38: 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 39: FUN(X[[i]], ...)
  where 40: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 41: force(code)
  where 42: doWithOneRestart(return(expr), restart)
  where 43: withOneRestart(expr, restarts[[1L]])
  where 44: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 45: 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 46: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 47: 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 48: 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 49: test_check("adjclust")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (mat, h) 
  {
      if (class(mat) == "dgCMatrix") 
          mat <- t(mat)
      p <- ncol(mat)
      x <- rep(p:1, each = h + 1)
      y <- x - rep(0:h, p)
      coord <- cbind(x, y)
      out <- rep(0, p * (h + 1))
      out[y >= 1] <- mat[coord[y >= 1, ]]
      out <- matrix(out, ncol = h + 1, byrow = TRUE)
      out[, -1] <- 2 * out[, -1]
      return(out)
  }
  <bytecode: 0x9b9ad48>
  <environment: namespace:adjclust>
   --- function search by body ---
  Function matR in namespace adjclust has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 11. Error: 'adjClust' returns a note when decreasing heights are produced and
  the condition has length > 1
  Backtrace:
   1. testthat::expect_message(fit <- adjClust(sim), "merges with non increasing heights")
   7. adjclust:::adjClust.matrix(sim)
   8. adjclust:::run.adjclust(mat, type = type, h = h)
   9. adjclust:::matR(mat, h)
  
  == testthat results  ===========================================================
  [ OK: 17 | SKIPPED: 4 | WARNINGS: 3 | FAILED: 11 ]
  1. Error: 'hclust' and 'adjClust' give identical results on toy data when the
            best merges are always adjacent merges (@test_adjclust_equivalentTo_hclust.R#16) 
  2. Error: rioja and adjClust with full band give identical results on toy data (@test_adjclust_equivalentTo_rioja.R#24) 
  3. Error: 'diagnose' and 'correct' must return a warning or a message when no reversals are found. (@test_correct.R#9) 
  4. Error: 'adjClust' returns a dendrogram with increasing heights for 
            'mode=corrected' (@test_corrected_plot.R#10) 
  5. Error: 'cuttree' must ignore 'h' when reversals are present. (@test_cuttree.R#10) 
  6. Error: test that adjClust gives identical results for sparse and dense matrices when h < p-1 (@test_dense_sparse_comparison.R#15) 
  7. Error: test that adjClust gives identical results for sparse and dense matrices when h is p-1 (@test_dense_sparse_comparison.R#35) 
  8. Error: 'adjClust' returns an object for which the sum of heights is the 
            dataset (pseudo) inertia (@test_final_height.R#10) 
  9. Error: (unknown) (@test_modify.R#10) 
  1. ...
  
  Error: testthat unit tests failed
  Execution halted