Running 'testthat.R' [7s/8s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(philentropy)
  > 
  > test_check("philentropy")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "canberra")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "canberra")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "canberra"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-canberra.R#31: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "canberra")), 
      test_canberra_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-canberra.R#28: test_that("distance(method = 'canberra') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "canberra")), test_canberra_dist(P, 
              Q))
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "canberra")), as.vector(stats::dist(base::rbind(P, 
              Q), method = "canberra")))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "canberra")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_canberra_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 1. Error: distance(method = 'canberra') computes the correct distance value. 
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "canberra")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(A, B), method = "canberra")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(A, B), method = "canberra")
  where 2: as.vector(philentropy::distance(rbind(A, B), method = "canberra"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-canberra.R#71: expect_equal(as.vector(philentropy::distance(rbind(A, B), method = "canberra")), 
      canb(A, B))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-canberra.R#49: test_that("distance(method = 'canberra') computes the correct distance value when P_i and Q_i are 0 -> 0/0 is then replaced by 0.", 
      {
          A <- c(0, 0.25, 0.25, 0, 0.25, 0.25)
          B <- c(0, 0, 0.25, 0.25, 0.25, 0.25)
          canb <- function(x, y) {
              dist <- vector(mode = "numeric", length = 1)
              dist <- 0
              for (i in 1:length(x)) {
                  if ((abs(x[i] - y[i]) == 0) | ((x[i] + y[i]) == 
                    0)) {
                    dist = dist
                  }
                  else {
                    dist = dist + (abs(x[i] - y[i])/((x[i]) + (y[i])))
                  }
              }
              return(dist)
          }
          expect_equal(as.vector(philentropy::distance(rbind(A, 
              B), method = "canberra")), canb(A, B))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 2. Error: distance(method = 'canberra') computes the correct distance value w
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(A, B), method = "canberra")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "chebyshev")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "chebyshev")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "chebyshev"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-chebyshev.R#26: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "chebyshev")), 
      max(abs((P) - (Q))))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-chebyshev.R#24: test_that("distance(method = 'chebyshev') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "chebyshev")), max(abs((P) - (Q))))
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "chebyshev")), as.vector(stats::dist(base::rbind(P, 
              Q), method = "maximum")))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "chebyshev")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              as.vector(dist(distMat, method = "maximum")))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 3. Error: distance(method = 'chebyshev') computes the correct distance value.
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "chebyshev")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P1, Q1), method = "chebyshev")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P1, Q1), method = "chebyshev")
  where 2: as.vector(philentropy::distance(rbind(P1, Q1), method = "chebyshev"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-chebyshev.R#50: expect_equal(as.vector(philentropy::distance(rbind(P1, Q1), method = "chebyshev")), 
      as.vector(stats::dist(base::rbind(P1, Q1), method = "maximum")))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-chebyshev.R#44: test_that("Correct chebyshev distance is computed when vectors contain 0 values ...", 
      {
          P1 <- c(1, 0)
          P2 <- c(0.5, 0.5)
          Q1 <- c(0.5, 0.5)
          Q2 <- c(1, 0)
          expect_equal(as.vector(philentropy::distance(rbind(P1, 
              Q1), method = "chebyshev")), as.vector(stats::dist(base::rbind(P1, 
              Q1), method = "maximum")))
          expect_equal(as.vector(philentropy::distance(rbind(P2, 
              Q2), method = "chebyshev")), as.vector(stats::dist(base::rbind(P2, 
              Q2), method = "maximum")))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 4. Error: Correct chebyshev distance is computed when vectors contain 0 value
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P1, Q1), method = "chebyshev")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "czekanowski")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "czekanowski")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "czekanowski"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-czekanowski.R#31: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "czekanowski")), 
      test_czekanowski_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-czekanowski.R#28: test_that("distance(method = 'czekanowski') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "czekanowski")), test_czekanowski_dist(P, 
              Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "czekanowski")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_czekanowski_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 5. Error: distance(method = 'czekanowski') computes the correct distance valu
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "czekanowski")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  distance(distMat, method = "czekanowski")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1 at testthat/test-dist-czekanowski.R#56: distance(distMat, method = "czekanowski")
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: 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 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: 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 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test-dist-czekanowski.R#47: test_that("Correct czekanowski distance is computed when vectors contain 0 values ...", 
      {
          P1 <- c(1, 0)
          P2 <- c(0.5, 0.5)
          Q1 <- c(0.5, 0.5)
          Q2 <- c(1, 0)
          distMat <- rbind(P1, Q1, P2, Q2)
          dist.vals <- distance(distMat, method = "czekanowski")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_czekanowski_dist))
      })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: 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 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: 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 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: 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 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: 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 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: 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 40: 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 41: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 6. Error: Correct czekanowski distance is computed when vectors contain 0 val
  the condition has length > 1
  Backtrace:
   1. philentropy::distance(distMat, method = "czekanowski")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  distance(distMat, method = "euclidien")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: distance(distMat, method = "euclidien")
  where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  where 3: withCallingHandlers({
      code
      NULL
  }, error = function(cnd) {
      if (can_entrace(cnd)) {
          cnd <- cnd_entrace(cnd)
      }
      return_from(env, cnd)
  })
  where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)), 
      ...)
  where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
  where 6 at testthat/test-dist-euclidean.R#27: expect_error(distance(distMat, method = "euclidien"), "Method 'euclidien' is not implemented in this function. Please consult getDistMethods().")
  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-dist-euclidean.R#23: test_that("'euclidien' (or any other not implemented string) is caught when wrong input string for method is entered", 
      {
          distMat <- rbind(rep(0.2, 5), rep(0.1, 10))
          expect_error(distance(distMat, method = "euclidien"), 
              "Method 'euclidien' is not implemented in this function. Please consult getDistMethods().")
      })
  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("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 7. Failure: 'euclidien' (or any other not implemented string) is caught when 
  `distance(distMat, method = "euclidien")` threw an error with unexpected message.
  Expected match: "Method 'euclidien' is not implemented in this function. Please consult getDistMethods()."
  Actual message: "the condition has length > 1"
  Backtrace:
   1. testthat::expect_error(...)
   6. philentropy::distance(distMat, method = "euclidien")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  distance(distMat, method = "euclidean")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: distance(distMat, method = "euclidean")
  where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  where 3: withCallingHandlers({
      code
      NULL
  }, error = function(cnd) {
      if (can_entrace(cnd)) {
          cnd <- cnd_entrace(cnd)
      }
      return_from(env, cnd)
  })
  where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)), 
      ...)
  where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
  where 6 at testthat/test-dist-euclidean.R#36: expect_error(distance(distMat, method = "euclidean"), paste0("Your input ", 
      class(distMat), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
  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-dist-euclidean.R#34: test_that("Only numeric values are passed to distance()", {
      distMat <- rbind(rep("A", 10), rep("B", 10))
      expect_error(distance(distMat, method = "euclidean"), paste0("Your input ", 
          class(distMat), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
  })
  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("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 8. Failure: Only numeric values are passed to distance() (@test-dist-euclidea
  `distance(distMat, method = "euclidean")` threw an error with unexpected message.
  Expected match: "Your input matrix stores non-numeric values. Non numeric values cannot be used to compute distances.."
  Actual message: "the condition has length > 1"
  Expected match: "Your input array stores non-numeric values. Non numeric values cannot be used to compute distances.."
  Actual message: "the condition has length > 1"
  Backtrace:
   1. testthat::expect_error(...)
   6. philentropy::distance(distMat, method = "euclidean")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  distance(distMat, method = "euclidean", unit = "log5")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: distance(distMat, method = "euclidean", unit = "log5")
  where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  where 3: withCallingHandlers({
      code
      NULL
  }, error = function(cnd) {
      if (can_entrace(cnd)) {
          cnd <- cnd_entrace(cnd)
      }
      return_from(env, cnd)
  })
  where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)), 
      ...)
  where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
  where 6 at testthat/test-dist-euclidean.R#49: expect_error(distance(distMat, method = "euclidean", unit = "log5"), 
      "You can only choose units: log, log2, or log10.")
  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-dist-euclidean.R#47: test_that("Only choose from units: log, log2, or log10", {
      distMat <- rbind(rep(0.2, 5), rep(0.1, 10))
      expect_error(distance(distMat, method = "euclidean", unit = "log5"), 
          "You can only choose units: log, log2, or log10.")
  })
  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("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 9. Failure: Only choose from units: log, log2, or log10 (@test-dist-euclidean
  `distance(distMat, method = "euclidean", unit = "log5")` threw an error with unexpected message.
  Expected match: "You can only choose units: log, log2, or log10."
  Actual message: "the condition has length > 1"
  Backtrace:
   1. testthat::expect_error(...)
   6. philentropy::distance(distMat, method = "euclidean", unit = "log5")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "euclidean")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "euclidean")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "euclidean"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-euclidean.R#57: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "euclidean")), 
      sqrt(sum(abs((P) - (Q))^2)))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-euclidean.R#55: test_that("distance(method = 'euclidean') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "euclidean")), sqrt(sum(abs((P) - (Q))^2)))
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "euclidean")), as.vector(stats::dist(base::rbind(P, 
              Q), method = "euclidean")))
          expect_equal(as.vector(philentropy::distance(rbind(V, 
              W), method = "euclidean")), as.vector(stats::dist(base::rbind(V, 
              W), method = "euclidean")))
          expect_equal(as.vector(philentropy::distance(rbind(V, 
              W), method = "euclidean")), sqrt(sum(abs((V) - (W))^2)))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "euclidean")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              as.vector(dist(distMat)))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 10. Error: distance(method = 'euclidean') computes the correct distance value
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "euclidean")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P1, Q1), method = "euclidean")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P1, Q1), method = "euclidean")
  where 2: as.vector(philentropy::distance(rbind(P1, Q1), method = "euclidean"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-euclidean.R#98: expect_equal(as.vector(philentropy::distance(rbind(P1, Q1), method = "euclidean")), 
      as.vector(stats::dist(base::rbind(P1, Q1), method = "euclidean")))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-euclidean.R#92: test_that("Correct euclidean distance is computed when vectors contain 0 values ...", 
      {
          P1 <- c(1, 0)
          P2 <- c(0.5, 0.5)
          Q1 <- c(0.5, 0.5)
          Q2 <- c(1, 0)
          expect_equal(as.vector(philentropy::distance(rbind(P1, 
              Q1), method = "euclidean")), as.vector(stats::dist(base::rbind(P1, 
              Q1), method = "euclidean")))
          expect_equal(as.vector(philentropy::distance(rbind(P2, 
              Q2), method = "euclidean")), as.vector(stats::dist(base::rbind(P2, 
              Q2), method = "euclidean")))
          distMat <- rbind(P1, Q1, P2, Q2)
          dist.vals <- distance(distMat, method = "euclidean")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              as.vector(dist(distMat)))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 11. Error: Correct euclidean distance is computed when vectors contain 0 valu
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P1, Q1), method = "euclidean")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "gower")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "gower")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "gower"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-gower.R#29: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "gower")), 
      test_gower_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-gower.R#27: test_that("distance(method = 'gower') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "gower")), test_gower_dist(P, Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "gower")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_gower_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 12. Error: distance(method = 'gower') computes the correct distance value. (@
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "gower")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  distance(distMat, method = "gower")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1 at testthat/test-dist-gower.R#51: distance(distMat, method = "gower")
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: 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 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: 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 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test-dist-gower.R#42: test_that("Correct gower distance is computed when vectors contain 0 values ...", 
      {
          P1 <- c(1, 0)
          P2 <- c(0.5, 0.5)
          Q1 <- c(0.5, 0.5)
          Q2 <- c(1, 0)
          distMat <- rbind(P1, Q1, P2, Q2)
          dist.vals <- distance(distMat, method = "gower")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_gower_dist))
      })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: 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 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: 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 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: 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 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: 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 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: 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 40: 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 41: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 13. Error: Correct gower distance is computed when vectors contain 0 values .
  the condition has length > 1
  Backtrace:
   1. philentropy::distance(distMat, method = "gower")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "intersection")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "intersection")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "intersection"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-intersection.R#31: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "intersection")), 
      test_intersection_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-intersection.R#27: test_that("distance(method = 'intersection') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "intersection")), test_intersection_dist(P, 
              Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "intersection")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_intersection_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 14. Error: distance(method = 'intersection') computes the correct distance va
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "intersection")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  distance(distMat, method = "intersection")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1 at testthat/test-dist-intersection.R#58: distance(distMat, method = "intersection")
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: 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 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: 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 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test-dist-intersection.R#49: test_that("Correct intersection distance is computed when vectors contain 0 values ...", 
      {
          P1 <- c(1, 0)
          P2 <- c(0.5, 0.5)
          Q1 <- c(0.5, 0.5)
          Q2 <- c(1, 0)
          distMat <- rbind(P1, Q1, P2, Q2)
          dist.vals <- distance(distMat, method = "intersection")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_intersection_dist))
      })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: 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 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: 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 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: 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 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: 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 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: 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 40: 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 41: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 15. Error: Correct intersection distance is computed when vectors contain 0 v
  the condition has length > 1
  Backtrace:
   1. philentropy::distance(distMat, method = "intersection")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "kulczynski_d")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "kulczynski_d")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "kulczynski_d"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-kulczynski_d.R#56: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "kulczynski_d")), 
      test_kd_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-kulczynski_d.R#54: test_that("distance(method = 'kulczynski_d') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "kulczynski_d")), test_kd_dist(P, Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "kulczynski_d")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_kd_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 16. Error: distance(method = 'kulczynski_d') computes the correct distance va
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "kulczynski_d")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  distance(distMat, method = "kulczynski_d")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1 at testthat/test-dist-kulczynski_d.R#80: distance(distMat, method = "kulczynski_d")
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: 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 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: 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 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test-dist-kulczynski_d.R#71: test_that("Correct kulczynski_d distance is computed when vectors contain 0 values ...", 
      {
          P1 <- c(1, 0)
          P2 <- c(0.5, 0.5)
          Q1 <- c(0.5, 0.5)
          Q2 <- c(1, 0)
          distMat <- rbind(P1, Q1, P2, Q2)
          dist.vals <- distance(distMat, method = "kulczynski_d")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_kd_dist))
      })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: 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 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: 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 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: 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 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: 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 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: 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 40: 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 41: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 17. Error: Correct kulczynski_d distance is computed when vectors contain 0 v
  the condition has length > 1
  Backtrace:
   1. philentropy::distance(distMat, method = "kulczynski_d")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "lorentzian")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "lorentzian")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "lorentzian"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-lorentzian.R#28: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "lorentzian")), 
      test_lorentzian_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-lorentzian.R#26: test_that("distance(method = 'lorentzian') computes the correct distance value using unit = log.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "lorentzian")), test_lorentzian_dist(P, 
              Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "lorentzian")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_lorentzian_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 18. Error: distance(method = 'lorentzian') computes the correct distance valu
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "lorentzian")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "lorentzian", unit = "log2")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "lorentzian", unit = "log2")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "lorentzian", 
      unit = "log2"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-lorentzian.R#45: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "lorentzian", 
      unit = "log2")), sum(log2(1 + abs((P) - (Q)))))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-lorentzian.R#42: test_that("distance(method = 'lorentzian') computes the correct distance value using unit = log2.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "lorentzian", unit = "log2")), sum(log2(1 + 
              abs((P) - (Q)))))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 19. Error: distance(method = 'lorentzian') computes the correct distance valu
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "lorentzian", unit = "log2")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "lorentzian", unit = "log10")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "lorentzian", unit = "log10")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "lorentzian", 
      unit = "log10"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-lorentzian.R#60: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "lorentzian", 
      unit = "log10")), sum(log10(1 + abs((P) - (Q)))))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-lorentzian.R#57: test_that("distance(method = 'lorentzian') computes the correct distance value using unit = log10.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "lorentzian", unit = "log10")), sum(log10(1 + 
              abs((P) - (Q)))))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 20. Error: distance(method = 'lorentzian') computes the correct distance valu
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "lorentzian", unit = "log10")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  distance(distMat, method = "lorentzian")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1 at testthat/test-dist-lorentzian.R#83: distance(distMat, method = "lorentzian")
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: 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 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: 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 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test-dist-lorentzian.R#74: test_that("Correct lorentzian distance is computed when vectors contain 0 values ...", 
      {
          P1 <- c(1, 0)
          P2 <- c(0.5, 0.5)
          Q1 <- c(0.5, 0.5)
          Q2 <- c(1, 0)
          distMat <- rbind(P1, Q1, P2, Q2)
          dist.vals <- distance(distMat, method = "lorentzian")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_lorentzian_dist))
      })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: 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 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: 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 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: 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 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: 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 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: 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 40: 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 41: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 21. Error: Correct lorentzian distance is computed when vectors contain 0 val
  the condition has length > 1
  Backtrace:
   1. philentropy::distance(distMat, method = "lorentzian")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "manhattan")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "manhattan")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "manhattan"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-manhattan.R#26: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "manhattan")), 
      sum(abs((P) - (Q))))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-manhattan.R#24: test_that("distance(method = 'manhattan') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "manhattan")), sum(abs((P) - (Q))))
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "manhattan")), as.vector(stats::dist(base::rbind(P, 
              Q), method = "manhattan")))
          expect_equal(as.vector(philentropy::distance(rbind(V, 
              W), method = "manhattan")), sum(abs((V) - (W))))
          expect_equal(as.vector(philentropy::distance(rbind(V, 
              W), method = "manhattan")), as.vector(stats::dist(base::rbind(V, 
              W), method = "manhattan")))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "manhattan")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              as.vector(dist(distMat, method = "manhattan")))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 22. Error: distance(method = 'manhattan') computes the correct distance value
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "manhattan")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P1, Q1), method = "manhattan")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P1, Q1), method = "manhattan")
  where 2: as.vector(philentropy::distance(rbind(P1, Q1), method = "manhattan"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-manhattan.R#55: expect_equal(as.vector(philentropy::distance(rbind(P1, Q1), method = "manhattan")), 
      as.vector(stats::dist(base::rbind(P1, Q1), method = "manhattan")))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-manhattan.R#49: test_that("Correct manhattan distance is computed when vectors contain 0 values ...", 
      {
          P1 <- c(1, 0)
          P2 <- c(0.5, 0.5)
          Q1 <- c(0.5, 0.5)
          Q2 <- c(1, 0)
          expect_equal(as.vector(philentropy::distance(rbind(P1, 
              Q1), method = "manhattan")), as.vector(stats::dist(base::rbind(P1, 
              Q1), method = "manhattan")))
          expect_equal(as.vector(philentropy::distance(rbind(P2, 
              Q2), method = "manhattan")), as.vector(stats::dist(base::rbind(P2, 
              Q2), method = "manhattan")))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 23. Error: Correct manhattan distance is computed when vectors contain 0 valu
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P1, Q1), method = "manhattan")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "minkowski", p = 4)
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "minkowski", p = 4)
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "minkowski", 
      p = 4))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-minkowski.R#26: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "minkowski", 
      p = 4)), (sum(abs((P) - (Q))^4))^0.25)
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-minkowski.R#24: test_that("distance(method = 'minkowski') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "minkowski", p = 4)), (sum(abs((P) - 
              (Q))^4))^0.25)
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "minkowski", p = 4)), as.vector(stats::dist(base::rbind(P, 
              Q), method = "minkowski", p = 4)))
          expect_error(as.vector(philentropy::distance(rbind(P, 
              Q), method = "minkowski")), "Please specify p for the Minkowski distance.")
          expect_equal(as.vector(philentropy::distance(rbind(V, 
              W), method = "minkowski", p = 4)), (sum(abs((V) - 
              (W))^4))^0.25)
          expect_equal(as.vector(philentropy::distance(rbind(V, 
              W), method = "minkowski", p = 4)), as.vector(stats::dist(base::rbind(V, 
              W), method = "minkowski", p = 4)))
          expect_error(as.vector(philentropy::distance(rbind(V, 
              W), method = "minkowski")), "Please specify p for the Minkowski distance.")
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "minkowski", 
              p = 4)
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              as.vector(dist(distMat, method = "minkowski", p = 4)))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 24. Error: distance(method = 'minkowski') computes the correct distance value
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "minkowski", p = 4)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P1, Q1), method = "minkowski", p = 4)
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P1, Q1), method = "minkowski", p = 4)
  where 2: as.vector(philentropy::distance(rbind(P1, Q1), method = "minkowski", 
      p = 4))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-minkowski.R#88: expect_equal(as.vector(philentropy::distance(rbind(P1, Q1), method = "minkowski", 
      p = 4)), as.vector(stats::dist(base::rbind(P1, Q1), method = "minkowski", 
      p = 4)))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-minkowski.R#82: test_that("Correct minkowski distance is computed when vectors contain 0 values ...", 
      {
          P1 <- c(1, 0)
          P2 <- c(0.5, 0.5)
          Q1 <- c(0.5, 0.5)
          Q2 <- c(1, 0)
          expect_equal(as.vector(philentropy::distance(rbind(P1, 
              Q1), method = "minkowski", p = 4)), as.vector(stats::dist(base::rbind(P1, 
              Q1), method = "minkowski", p = 4)))
          expect_equal(as.vector(philentropy::distance(rbind(P2, 
              Q2), method = "minkowski", p = 4)), as.vector(stats::dist(base::rbind(P2, 
              Q2), method = "minkowski", p = 4)))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 25. Error: Correct minkowski distance is computed when vectors contain 0 valu
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P1, Q1), method = "minkowski", p = 4)
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "non-intersection")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "non-intersection")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "non-intersection"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-non_intersecting.R#25: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "non-intersection")), 
      1 - sum(apply(base::rbind(P, Q), 2, min)))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-non_intersecting.R#23: test_that("distance(method = 'non-intersection') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "non-intersection")), 1 - sum(apply(base::rbind(P, 
              Q), 2, min)))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 26. Error: distance(method = 'non-intersection') computes the correct distanc
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "non-intersection")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "non-intersection")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "non-intersection")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "non-intersection"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-non_intersecting.R#37: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "non-intersection")), 
      1 - sum(apply(base::rbind(P, Q), 2, min)))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-non_intersecting.R#32: test_that("Correct non-intersection distance is computed when vectors contain 0 values ...", 
      {
          P <- c(1, 0)
          Q <- c(0.5, 0.5)
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "non-intersection")), 1 - sum(apply(base::rbind(P, 
              Q), 2, min)))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 27. Error: Correct non-intersection distance is computed when vectors contain
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "non-intersection")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "soergel")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "soergel")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "soergel"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-soergel.R#30: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "soergel")), 
      test_soergel_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-soergel.R#28: test_that("distance(method = 'soergel') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "soergel")), test_soergel_dist(P, Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "soergel")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_soergel_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 28. Error: distance(method = 'soergel') computes the correct distance value. 
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "soergel")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  distance(distMat, method = "soergel")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1 at testthat/test-dist-soergel.R#53: distance(distMat, method = "soergel")
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: 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 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: 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 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test-dist-soergel.R#44: test_that("Correct soergel distance is computed when vectors contain 0 values ...", 
      {
          P1 <- c(1, 0)
          P2 <- c(0.5, 0.5)
          Q1 <- c(0.5, 0.5)
          Q2 <- c(1, 0)
          distMat <- rbind(P1, Q1, P2, Q2)
          dist.vals <- distance(distMat, method = "soergel")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_soergel_dist))
      })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: 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 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: 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 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: 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 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: 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 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: 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 40: 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 41: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 29. Error: Correct soergel distance is computed when vectors contain 0 values
  the condition has length > 1
  Backtrace:
   1. philentropy::distance(distMat, method = "soergel")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "sorensen")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "sorensen")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "sorensen"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-sorensen.R#35: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "sorensen")), 
      test_sorensen_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-sorensen.R#31: test_that("distance(method = 'sorensen') computes the correct distance value.", 
      {
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "sorensen")), test_sorensen_dist(P, 
              Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "sorensen")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_sorensen_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 30. Error: distance(method = 'sorensen') computes the correct distance value.
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "sorensen")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  distance(distMat, method = "sorensen")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1 at testthat/test-dist-sorensen.R#59: distance(distMat, method = "sorensen")
  where 2: eval(code, test_env)
  where 3: eval(code, test_env)
  where 4: 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 5: doTryCatch(return(expr), name, parentenv, handler)
  where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 10: tryCatchList(expr, classes, parentenv, handlers)
  where 11: 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 12: test_code(desc, code, env = parent.frame())
  where 13 at testthat/test-dist-sorensen.R#51: test_that("Correct sorensen distance is computed when vectors contain 0 values ...", 
      {
          P1 <- c(1, 0)
          P2 <- c(0.5, 0.5)
          Q1 <- c(0.5, 0.5)
          Q2 <- c(1, 0)
          distMat <- rbind(P1, Q1, P2, Q2)
          dist.vals <- distance(distMat, method = "sorensen")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_sorensen_dist))
      })
  where 14: eval(code, test_env)
  where 15: eval(code, test_env)
  where 16: 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 17: doTryCatch(return(expr), name, parentenv, handler)
  where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 22: tryCatchList(expr, classes, parentenv, handlers)
  where 23: 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 24: test_code(NULL, exprs, env)
  where 25: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 26: force(code)
  where 27: doWithOneRestart(return(expr), restart)
  where 28: withOneRestart(expr, restarts[[1L]])
  where 29: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 30: 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 31: FUN(X[[i]], ...)
  where 32: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: 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 38: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 39: 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 40: 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 41: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 31. Error: Correct sorensen distance is computed when vectors contain 0 value
  the condition has length > 1
  Backtrace:
   1. philentropy::distance(distMat, method = "sorensen")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "wavehedges")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "wavehedges")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "wavehedges"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-wavehedges.R#31: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "wavehedges")), 
      test_wh_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-wavehedges.R#25: test_that("distance(method = 'wavehedges') computes the correct distance value.", 
      {
          test_wh_dist <- function(P, Q) {
              sum(abs(P - Q)/apply(base::rbind(P, Q), 2, max))
          }
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "wavehedges")), test_wh_dist(P, Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "wavehedges")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_wh_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 32. Error: distance(method = 'wavehedges') computes the correct distance valu
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "wavehedges")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(A, B), method = "wavehedges")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(A, B), method = "wavehedges")
  where 2: as.vector(philentropy::distance(rbind(A, B), method = "wavehedges"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-dist-wavehedges.R#68: expect_equal(as.vector(philentropy::distance(rbind(A, B), method = "wavehedges")), 
      wh(A, B))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-dist-wavehedges.R#46: test_that("distance(method = 'wavehedges') computes the correct distance value in case the input probability vectors store 0 values at the same position causing 0/0 computations.", 
      {
          A <- c(0, 0.25, 0.25, 0, 0.25, 0.25)
          B <- c(0, 0, 0.25, 0.25, 0.25, 0.25)
          wh <- function(x, y) {
              dist <- vector(mode = "numeric", length = 1)
              dist <- 0
              for (i in 1:length(x)) {
                  if ((abs(x[i] - y[i]) == 0) | ((max(c(x[i], y[i]))) == 
                    0)) {
                    dist = dist
                  }
                  else {
                    dist = dist + (abs(x[i] - y[i])/max(c(x[i], 
                      y[i])))
                  }
              }
              return(dist)
          }
          expect_equal(as.vector(philentropy::distance(rbind(A, 
              B), method = "wavehedges")), wh(A, B))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 33. Error: distance(method = 'wavehedges') computes the correct distance valu
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(A, B), method = "wavehedges")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "motyka")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "motyka")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "motyka"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-distances.R#49: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "motyka")), 
      test_motyka_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-distances.R#43: test_that("distance(method = 'motyka') computes the correct distance value.", 
      {
          test_motyka_dist <- function(P, Q) {
              sum(apply(base::rbind(P, Q), 2, max))/sum(P + Q)
          }
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "motyka")), test_motyka_dist(P, Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "motyka")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_motyka_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 34. Error: distance(method = 'motyka') computes the correct distance value. (
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "motyka")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "kulczynski_s")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "kulczynski_s")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "kulczynski_s"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-distances.R#72: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "kulczynski_s")), 
      test_ks_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-distances.R#64: test_that("distance(method = 'kulczynski_s') computes the correct distance value.", 
      {
          test_ks_dist <- function(P, Q) {
              1/(sum(abs((P) - (Q)))/sum(apply(rbind(P, Q), 2, 
                  min)))
          }
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "kulczynski_s")), test_ks_dist(P, Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "kulczynski_s")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_ks_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 35. Error: distance(method = 'kulczynski_s') computes the correct distance va
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "kulczynski_s")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "tanimoto")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "tanimoto")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "tanimoto"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-distances.R#96: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "tanimoto")), 
      test_tanimoto_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-distances.R#90: test_that("distance(method = 'tanimoto') computes the correct distance value.", 
      {
          test_tanimoto_dist <- function(P, Q) {
              sum(abs((P) - (Q)))/sum(apply(rbind(P, Q), 2, max))
          }
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "tanimoto")), test_tanimoto_dist(P, 
              Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "tanimoto")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_tanimoto_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 36. Error: distance(method = 'tanimoto') computes the correct distance value.
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "tanimoto")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "ruzicka")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "ruzicka")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "ruzicka"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-distances.R#120: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "ruzicka")), 
      test_ruzicka_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-distances.R#112: test_that("distance(method = 'ruzicka') computes the correct distance value.", 
      {
          test_ruzicka_dist <- function(P, Q) {
              1 - (sum(abs((P) - (Q)))/sum(apply(rbind(P, Q), 2, 
                  max)))
          }
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "ruzicka")), test_ruzicka_dist(P, Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "ruzicka")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_ruzicka_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 37. Error: distance(method = 'ruzicka') computes the correct distance value. 
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "ruzicka")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "inner_product")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "inner_product")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "inner_product"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-distances.R#142: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "inner_product")), 
      test_innerproduct_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-distances.R#136: test_that("distance(method = 'inner_product') computes the correct distance value.", 
      {
          test_innerproduct_dist <- function(P, Q) {
              sum(P * Q)
          }
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "inner_product")), test_innerproduct_dist(P, 
              Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "inner_product")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_innerproduct_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 38. Error: distance(method = 'inner_product') computes the correct distance v
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "inner_product")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "harmonic_mean")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "harmonic_mean")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "harmonic_mean"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-distances.R#166: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "harmonic_mean")), 
      test_harmonic_mean_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-distances.R#160: test_that("distance(method = 'harmonic_mean') computes the correct distance value.", 
      {
          test_harmonic_mean_dist <- function(P, Q) {
              2 * sum((P * Q)/(P + Q))
          }
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "harmonic_mean")), test_harmonic_mean_dist(P, 
              Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "harmonic_mean")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_harmonic_mean_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 39. Error: distance(method = 'harmonic_mean') computes the correct distance v
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "harmonic_mean")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(A, B), method = "harmonic_mean")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(A, B), method = "harmonic_mean")
  where 2: as.vector(philentropy::distance(rbind(A, B), method = "harmonic_mean"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-distances.R#207: expect_equal(as.vector(philentropy::distance(rbind(A, B), method = "harmonic_mean")), 
      hm(A, B))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-distances.R#183: test_that("distance(method = 'harmonic_mean') computes the correct distance value in case input probability vectors store 0 values at the same position causing 0/0 computation\n        \n        .", 
      {
          A <- c(0, 0.25, 0.25, 0, 0.25, 0.25)
          B <- c(0, 0, 0.25, 0.25, 0.25, 0.25)
          hm <- function(x, y) {
              dist <- vector(mode = "numeric", length = 1)
              dist <- 0
              for (i in 1:length(x)) {
                  if (((x[i] * y[i]) == 0) & ((x[i] + y[i]) == 
                    0)) {
                    dist = dist
                  }
                  else {
                    dist = dist + ((x[i] * y[i])/(x[i] + y[i]))
                  }
              }
              return(2 * dist)
          }
          expect_equal(as.vector(philentropy::distance(rbind(A, 
              B), method = "harmonic_mean")), hm(A, B))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 40. Error: distance(method = 'harmonic_mean') computes the correct distance v
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(A, B), method = "harmonic_mean")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "cosine")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "cosine")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "cosine"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-distances.R#224: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "cosine")), 
      test_cosine_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-distances.R#216: test_that("distance(method = 'cosine') computes the correct distance value.", 
      {
          test_cosine_dist <- function(P, Q) {
              ((sum((P) * (Q)))/(sqrt(sum((P)^2)) * sqrt(sum((Q)^2))))
          }
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "cosine")), test_cosine_dist(P, Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "cosine")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_cosine_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 41. Error: distance(method = 'cosine') computes the correct distance value. (
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "cosine")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "hassebrook")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "hassebrook")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "hassebrook"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-distances.R#249: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "hassebrook")), 
      test_hassebrook_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-distances.R#240: test_that("distance(method = 'hassebrook') computes the correct distance value.", 
      {
          test_hassebrook_dist <- function(P, Q) {
              ((sum((P) * (Q)))/(sum((P)^2) + sum((Q)^2) - ((sum((P) * 
                  (Q))))))
          }
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "hassebrook")), test_hassebrook_dist(P, 
              Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "hassebrook")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_hassebrook_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 42. Error: distance(method = 'hassebrook') computes the correct distance valu
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "hassebrook")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "jaccard")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "jaccard")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "jaccard"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-distances.R#274: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "jaccard")), 
      test_jaccard_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-distances.R#266: test_that("distance(method = 'jaccard') computes the correct distance value.", 
      {
          test_jaccard_dist <- function(P, Q) {
              1 - ((sum((P) * (Q)))/(sum((P)^2) + sum((Q)^2) - 
                  ((sum((P) * (Q))))))
          }
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "jaccard")), test_jaccard_dist(P, Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "jaccard")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_jaccard_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_euclidean, test.na)
      }
      else if (method == "pearson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- pearson_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, pearson_chi_sq, test.na)
      }
      else if (method == "neyman") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- neyman_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, neyman_chi_sq, test.na)
      }
      else if (method == "squared_chi") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chi_sq, test.na)
      }
      else if (method == "prob_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- prob_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, prob_symm_chi_sq, test.na)
      }
      else if (method == "divergence") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- divergence_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, divergence_sq, test.na)
      }
      else if (method == "clark") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- clark_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, clark_sq, test.na)
      }
      else if (method == "additive_symm") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- additive_symm_chi_sq(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, additive_symm_chi_sq, 
                  test.na)
      }
      else if (method == "kullback-leibler") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- kullback_leibler_distance(x[, 1], x[, 2], 
                  test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, kullback_leibler_distance, 
                  test.na, unit)
      }
      else if (method == "jeffreys") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jeffreys(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jeffreys, test.na, unit)
      }
      else if (method == "k_divergence") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- k_divergence(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, k_divergence, test.na, unit)
      }
      else if (method == "topsoe") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- topsoe(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, topsoe, test.na, unit)
      }
      else if (method == "jensen-shannon") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_shannon(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_shannon, test.na, unit)
      }
      else if (method == "jensen_difference") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- jensen_difference(x[, 1], x[, 2], test.na, 
                  unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, jensen_difference, test.na, 
                  unit)
      }
      else if (method == "taneja") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- taneja(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, taneja, test.na, unit)
      }
      else if (method == "kumar-johnson") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_johnson(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_johnson, test.na)
      }
      else if (method == "avg") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- avg(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, avg, test.na)
      }
      if (ncols == 2) {
          names(dist) <- method
      }
      else {
          colnames(dist) <- paste0("v", seq_len(ncols))
          rownames(dist) <- paste0("v", seq_len(ncols))
      }
      return(dist)
  }
  <bytecode: 0x1e938f0>
  <environment: namespace:philentropy>
   --- function search by body ---
  Function distance in namespace philentropy has this body.
   ----------- END OF FAILURE REPORT -------------- 
  -- 43. Error: distance(method = 'jaccard') computes the correct distance value. 
  the condition has length > 1
  Backtrace:
   1. testthat::expect_equal(...)
   5. philentropy::distance(rbind(P, Q), method = "jaccard")
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  philentropy
   --- call from context --- 
  philentropy::distance(rbind(P, Q), method = "dice")
   --- call from argument --- 
  if (!is.element(class(x), c("data.frame", "matrix"))) stop("x should be a data.frame or matrix.")
   --- R stacktrace ---
  where 1: philentropy::distance(rbind(P, Q), method = "dice")
  where 2: as.vector(philentropy::distance(rbind(P, Q), method = "dice"))
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5 at testthat/test-distances.R#295: expect_equal(as.vector(philentropy::distance(rbind(P, Q), method = "dice")), 
      test_dice_dist(P, Q))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-distances.R#289: test_that("distance(method = 'dice') computes the correct distance value.", 
      {
          test_dice_dist <- function(P, Q) {
              1 - (2 * (sum((P) * (Q)))/(sum((P)^2) + sum((Q)^2)))
          }
          expect_equal(as.vector(philentropy::distance(rbind(P, 
              Q), method = "dice")), test_dice_dist(P, Q))
          distMat <- rbind(rep(0.2, 5), rep(0.1, 5), c(5, 1, 7, 
              9, 5))
          dist.vals <- distance(distMat, method = "dice")
          expect_equal(dist.vals[lower.tri(dist.vals, diag = FALSE)], 
              test_dist_matrix(distMat, FUN = test_dice_dist))
      })
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("philentropy")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (x, method = "euclidean", p = NULL, test.na = TRUE, 
      unit = "log", est.prob = NULL) 
  {
      if (!is.element(class(x), c("data.frame", "matrix"))) 
          stop("x should be a data.frame or matrix.")
      if (is.character(x)) 
          stop(paste0("Your input ", class(x), " stores non-numeric values. Non numeric values cannot be used to compute distances.."))
      dist_methods <- vector(mode = "character", length = 46)
      dist_methods <- c("euclidean", "manhattan", "minkowski", 
          "chebyshev", "sorensen", "gower", "soergel", "kulczynski_d", 
          "canberra", "lorentzian", "intersection", "non-intersection", 
          "wavehedges", "czekanowski", "motyka", "kulczynski_s", 
          "tanimoto", "ruzicka", "inner_product", "harmonic_mean", 
          "cosine", "hassebrook", "jaccard", "dice", "fidelity", 
          "bhattacharyya", "hellinger", "matusita", "squared_chord", 
          "squared_euclidean", "pearson", "neyman", "squared_chi", 
          "prob_symm", "divergence", "clark", "additive_symm", 
          "kullback-leibler", "jeffreys", "k_divergence", "topsoe", 
          "jensen-shannon", "jensen_difference", "taneja", "kumar-johnson", 
          "avg")
      x <- t(x)
      ncols <- vector("numeric", 1)
      ncols <- ncol(x)
      if (!is.element(method, dist_methods)) 
          stop("Method '", method, "' is not implemented in this function. Please consult getDistMethods().", 
              call. = FALSE)
      if (!is.null(est.prob)) {
          x <- apply(x, 2, estimate.probability, method = est.prob)
      }
      if (!is.element(unit, c("log", "log2", "log10"))) 
          stop("You can only choose units: log, log2, or log10.", 
              call. = FALSE)
      if (ncols == 2) {
          dist <- vector("numeric", 1)
      }
      else {
          dist <- matrix(NA_real_, ncols, ncols)
      }
      if (method == "euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, euclidean, test.na)
      }
      else if (method == "manhattan") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- manhattan(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, manhattan, test.na)
      }
      else if (method == "minkowski") {
          message("Metric: '", method, "'; p = ", p, "; comparing: ", 
              ncols, " vectors.")
          if (!is.null(p)) {
              if (ncols == 2) 
                  dist <- minkowski(x[, 1], x[, 2], as.double(p), 
                    test.na)
              if (ncols > 2) 
                  dist <- DistMatrixMinkowski(x, as.double(p), 
                    test.na)
          }
          else {
              stop("Please specify p for the Minkowski distance.", 
                  call. = FALSE)
          }
      }
      else if (method == "chebyshev") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- chebyshev(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, chebyshev, test.na)
      }
      else if (method == "sorensen") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- sorensen(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, sorensen, test.na)
      }
      else if (method == "gower") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- gower(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, gower, test.na)
      }
      else if (method == "soergel") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- soergel(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, soergel, test.na)
      }
      else if (method == "kulczynski_d") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "canberra") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- canberra(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, canberra, test.na)
      }
      else if (method == "lorentzian") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- lorentzian(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, lorentzian, test.na, unit)
      }
      else if (method == "intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, intersection_dist, test.na)
      }
      else if (method == "non-intersection") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1 - intersection_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1 - DistMatrixNoUnit(x, intersection_dist, 
                  test.na)
      }
      else if (method == "wavehedges") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- wave_hedges(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, wave_hedges, test.na)
      }
      else if (method == "czekanowski") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- czekanowski(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, czekanowski, test.na)
      }
      else if (method == "motyka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- motyka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, motyka, test.na)
      }
      else if (method == "kulczynski_s") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- 1/kulczynski_d(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- 1/DistMatrixNoUnit(x, kulczynski_d, test.na)
      }
      else if (method == "tanimoto") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- tanimoto(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, tanimoto, test.na)
      }
      else if (method == "ruzicka") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- ruzicka(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, ruzicka, test.na)
      }
      else if (method == "inner_product") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- inner_product(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, inner_product, test.na)
      }
      else if (method == "harmonic_mean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- harmonic_mean_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, harmonic_mean_dist, test.na)
      }
      else if (method == "cosine") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- cosine_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, cosine_dist, test.na)
      }
      else if (method == "hassebrook") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- kumar_hassebrook(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, kumar_hassebrook, test.na)
      }
      else if (method == "jaccard") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- jaccard(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, jaccard, test.na)
      }
      else if (method == "dice") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- dice_dist(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, dice_dist, test.na)
      }
      else if (method == "fidelity") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- fidelity(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, fidelity, test.na)
      }
      else if (method == "bhattacharyya") {
          message("Metric: '", method, "' using unit: '", unit, 
              "'; comparing: ", ncols, " vectors.")
          if (ncols == 2) 
              dist <- bhattacharyya(x[, 1], x[, 2], test.na, unit)
          if (ncols > 2) 
              dist <- DistMatrix(x, bhattacharyya, test.na, unit)
      }
      else if (method == "hellinger") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- hellinger(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, hellinger, test.na)
      }
      else if (method == "matusita") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (any(colSums(x) > 1.00001)) 
              stop("Please make sure that all vectors sum up to 1.0 ...", 
                  call. = FALSE)
          if (ncols == 2) 
              dist <- matusita(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, matusita, test.na)
      }
      else if (method == "squared_chord") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_chord(x[, 1], x[, 2], test.na)
          if (ncols > 2) 
              dist <- DistMatrixNoUnit(x, squared_chord, test.na)
      }
      else if (method == "squared_euclidean") {
          message("Metric: '", method, "'; comparing: ", ncols, 
              " vectors.")
          if (ncols == 2) 
              dist <- squared_euclidean(x[, 1], x[, 2], test.na)
          if (ncols > 2)