Running ‘test-all.R’ [3s/5s]
Running the tests in ‘tests/test-all.R’ failed.
Complete output:
  > library(testthat)
  > 
  > test_check("biogram")
  Loading required package: biogram
  Loading required package: slam
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  biogram
   --- call from context --- 
  test_features(tar_feat1[, 1, drop = FALSE], cbind(tar_feat1[, 
      2], tar_feat2[, 2], tar_feat3[, 2]))
   --- call from argument --- 
  if (class(features) == "simple_triplet_matrix") {
      slam::col_sums(features)
  } else {
      colSums(features)
  }
   --- R stacktrace ---
  where 1 at testthat/test_quipt_consistency.R#8: test_features(tar_feat1[, 1, drop = FALSE], cbind(tar_feat1[, 
      2], tar_feat2[, 2], tar_feat3[, 2]))
  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_quipt_consistency.R#3: test_that("Exact test and permutation test are consistent", {
      set.seed(1)
      tar_feat1 <- create_feature_target(10, 390, 0, 600)
      tar_feat2 <- create_feature_target(9, 391, 1, 599)
      tar_feat3 <- create_feature_target(8, 392, 2, 598)
      fast.results <- test_features(tar_feat1[, 1, drop = FALSE], 
          cbind(tar_feat1[, 2], tar_feat2[, 2], tar_feat3[, 2]))
      m <- 10000
      perm.results <- test_features(tar_feat1[, 1, drop = FALSE], 
          cbind(tar_feat1[, 2], tar_feat2[, 2], tar_feat3[, 2]), 
          times = m, quick = FALSE)
      alfa <- 0.1
      conf.intervals <- sapply(perm.results, function(x) {
          x <- (x * m + 0.5 * qnorm(alfa)^2)/(m + qnorm(alfa)^2)
          x + qnorm(c(alfa/2, 1 - alfa/2)) * sqrt(x * (1 - x)/(m + 
              qnorm(alfa)^2))
      })
      for (i in 1:3) {
          expect_true(fast.results[i] < conf.intervals[2, i])
          expect_true(fast.results[i] > conf.intervals[1, i])
      }
  })
  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("biogram")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (target, features, criterion = "ig", adjust = "BH", 
      threshold = 1, quick = TRUE, times = 1e+05) 
  {
      valid_criterion <- check_criterion(criterion)
      crit_function <- function(target, features) calc_criterion(target, 
          features, valid_criterion[["crit_function"]])
      if (!all(target %in% c(0, 1))) {
          stop("'target' is not {0,1}-valued vector")
      }
      if (length(unique(target)) != 2) {
          stop("Both classes must be present in 'target'.")
      }
      if (nrow(features) != length(target)) {
          stop("'target' and 'features' have different number of cases.")
      }
      apply(features, 2, function(feature) {
          if (!all(feature %in% c(0, 1))) {
              stop("'features' are not {0,1}-valued matrix. Consider using binarize().")
          }
      })
      feature_size <- if (class(features) == "simple_triplet_matrix") {
          slam::col_sums(features)
      }
      else {
          colSums(features)
      }
      features <- features[, feature_size > threshold & feature_size < 
          (nrow(features) - threshold), drop = FALSE]
      p_vals <- if (quick) {
          feature_size <- unique(feature_size)
          dists <- lapply(feature_size, function(i) {
              t <- create_feature_target(i, abs(sum(target) - i), 
                  0, abs(length(target) - sum(target)))
              distr_crit(t[, 1], t[, 2], criterion = criterion)
          })
          names(dists) <- feature_size
          apply(features, 2, function(feature) {
              feature <- as.matrix(feature, ncol = 1)
              estm <- crit_function(target, feature)
              dist <- dists[[paste(sum(feature))]]
              1 - dist[which.max(dist[, "criterion"] >= estm - 
                  1e-15), "cdf"]
          })
      }
      else {
          rowMeans(crit_function(target, features) <= replicate(times, 
              crit_function(sample(target), features)))
      }
      p_vals[p_vals > 1] <- 1
      if (!is.null(adjust)) 
          p_vals <- p.adjust(p_vals, method = adjust)
      create_feature_test(p_value = p_vals, criterion = valid_criterion[["nice_name"]], 
          adjust = adjust, times = ifelse(quick, NA, times), occ = calc_occurences(target, 
              features))
  }
  <bytecode: 0x564a21234f50>
  <environment: namespace:biogram>
   --- function search by body ---
  Function test_features in namespace biogram has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1