Running ‘testthat.R’ [7s/10s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(gustave)
  > 
  > test_check("gustave")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  gustave
   --- call from context --- 
  res_cal(y = y[calib$id, , drop = FALSE], precalc = calib$precalc)
   --- call from argument --- 
  if (class(e) != class_y) e <- methods::as(e, class_y)
   --- R stacktrace ---
  where 1: res_cal(y = y[calib$id, , drop = FALSE], precalc = calib$precalc)
  where 2: qvar_variance_function(y, samp = samp, nrc = nrc, calib = calib)
  where 3: eval(substitute(expr), data, enclos = parent.frame())
  where 4: eval(substitute(expr), data, enclos = parent.frame())
  where 5: with.default(technical_data_ict, qvar_variance_function(y, samp = samp, 
      nrc = nrc, calib = calib))
  where 6: with(technical_data_ict, qvar_variance_function(y, samp = samp, 
      nrc = nrc, calib = calib))
  where 7: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  where 8: withCallingHandlers({
      code
      NULL
  }, error = function(cnd) {
      cnd <- cnd_entrace(cnd)
      return_from(env, cnd)
  })
  where 9: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)), 
      ...)
  where 10: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
  where 11 at testthat/test_qvar.R#35: expect_error(with(technical_data_ict, qvar_variance_function(y, 
      samp = samp, nrc = nrc, calib = calib)), regexp = NA)
  where 12: eval(code, test_env)
  where 13: eval(code, test_env)
  where 14: 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 15: doTryCatch(return(expr), name, parentenv, handler)
  where 16: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 17: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 18: doTryCatch(return(expr), name, parentenv, handler)
  where 19: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 20: tryCatchList(expr, classes, parentenv, handlers)
  where 21: 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 22: test_code(desc, code, env = parent.frame())
  where 23 at testthat/test_qvar.R#34: test_that("qvar_variance_function works", {
      expect_error(with(technical_data_ict, qvar_variance_function(y, 
          samp = samp, nrc = nrc, calib = calib)), regexp = NA)
  })
  where 24: eval(code, test_env)
  where 25: eval(code, test_env)
  where 26: 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 27: doTryCatch(return(expr), name, parentenv, handler)
  where 28: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 29: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 30: doTryCatch(return(expr), name, parentenv, handler)
  where 31: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 32: tryCatchList(expr, classes, parentenv, handlers)
  where 33: 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 34: test_code(NULL, exprs, env)
  where 35: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: with_reporter(reporter = 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 41: FUN(X[[i]], ...)
  where 42: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 43: force(code)
  where 44: doWithOneRestart(return(expr), restart)
  where 45: withOneRestart(expr, restarts[[1L]])
  where 46: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 47: 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 48: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 49: 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 50: 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 51: test_check("gustave")
  
   --- value of length: 2 type: logical ---
  [1] TRUE TRUE
   --- function from context --- 
  function (y = NULL, x, w = NULL, by = NULL, precalc = NULL, id = NULL) 
  {
      if (is.null(precalc)) {
          if (is.null(w)) 
              w <- rep(1, NROW(x))
          x <- coerce_to_TsparseMatrix(x)
          if (!is.null(by)) 
              x <- detect_block(x, by) %||% make_block(x, by)
          while (TRUE) {
              u <- crossprod(x, Matrix::Diagonal(x = w) %*% x)
              if (Matrix::rankMatrix(u, method = "qr") != NROW(u)) {
                  is_colinear <- as.vector(is.na(stats::lm.fit(x = as.matrix(u), 
                    y = rep(1, NROW(u)))$coef))
                  if (any(is_colinear)) 
                    note("Some variables in x were discarded due to collinearity.")
                  x <- x[, !is_colinear, drop = FALSE]
              }
              else break
          }
          inv <- solve(u)
      }
      else list2env(precalc, envir = environment())
      if (is.null(y)) 
          return(list(x = x, w = w, inv = inv))
      else {
          class_y <- class(y)
          dimnames_y <- dimnames(y)
          y <- coerce_to_TsparseMatrix(y)
          if (!is.null(precalc) && !is.null(id) && !is.null(rownames(y)) && 
              !identical(as.character(id), rownames(y))) 
              stop("The names of the data matrix (y argument) do not match the reference id (id argument).")
          e <- y - x %*% (inv %*% crossprod(x, Matrix::Diagonal(x = w) %*% 
              y))
          if (class(e) != class_y) 
              e <- methods::as(e, class_y)
          dimnames(e) <- dimnames_y
          e
      }
  }
  <bytecode: 0x55e588288390>
  <environment: namespace:gustave>
   --- function search by body ---
  Function res_cal in namespace gustave has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1