Running ‘testthat.R’ [3s/5s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(imbalance)
  > 
  > test_check("imbalance")
  [1] "0 samples filtered by NEATER"
  [1] "11 samples filtered by NEATER"
  [1] "0 samples filtered by NEATER"
  [1] "3 samples filtered by NEATER"
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  imbalance
   --- call from context --- 
  pdfos(dataset, numInstances = nInstances, classAttr = "Class")
   --- call from argument --- 
  if (class(covInverse) == "try-error") stop(paste("Not a valid method for this dataset.", 
      "Variance of the positive class is not an invertible matrix"))
   --- R stacktrace ---
  where 1 at testthat/testPDFOS.R#19: pdfos(dataset, numInstances = nInstances, classAttr = "Class")
  where 2 at testthat/testPDFOS.R#27: pdfosTestOutput("glass0")
  where 3: eval(code, test_env)
  where 4: eval(code, test_env)
  where 5: 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 6: doTryCatch(return(expr), name, parentenv, handler)
  where 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 8: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 11: tryCatchList(expr, classes, parentenv, handlers)
  where 12: 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 13: test_code(NULL, exprs, env)
  where 14: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 15: force(code)
  where 16: doWithOneRestart(return(expr), restart)
  where 17: withOneRestart(expr, restarts[[1L]])
  where 18: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 19: 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 20: FUN(X[[i]], ...)
  where 21: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 22: force(code)
  where 23: doWithOneRestart(return(expr), restart)
  where 24: withOneRestart(expr, restarts[[1L]])
  where 25: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 26: 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 27: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 28: 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 29: 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 30: test_check("imbalance")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (dataset, numInstances, classAttr = "Class") 
  {
      checkDataset(dataset)
      checkDatasetClass(dataset, classAttr)
      originalShape <- datasetStructure(dataset, classAttr)
      dataset <- toNumeric(dataset, exclude = classAttr)
      checkAllColumnsNumeric(dataset, exclude = classAttr)
      if (!is.numeric(numInstances) || numInstances <= 0) 
          stop("numInstances must be a positive integer")
      minority <- selectMinority(dataset, classAttr)
      minority <- data.matrix(minority)
      covariance <- stats::var(minority)
      covInverse <- try(solve(covariance))
      if (class(covInverse) == "try-error") 
          stop(paste("Not a valid method for this dataset.", "Variance of the positive class is not an invertible matrix"))
      myBandwidth <- bestGaussianBandwidth(minority, covInverse)
      samples <- minority[sample(1:nrow(minority), numInstances, 
          replace = T), ]
      newSamples <- t(apply(samples, MARGIN = 1, function(row) {
          mvtnorm::rmvnorm(1, mean = data.matrix(row), sigma = myBandwidth * 
              covariance, method = "chol")
      }))
      normalizeNewSamples(originalShape, newSamples)
  }
  <bytecode: 0x5650d93622c0>
  <environment: namespace:imbalance>
   --- function search by body ---
  Function pdfos in namespace imbalance has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1