Running ‘testthat.R’ [3s/5s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(rbridge)
  > 
  > test_check("rbridge")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  rbridge
   --- call from context --- 
  rbridge(X, y, q = 1, R1.mat, r1.vec)
   --- call from argument --- 
  if (class(X) != "matrix") {
      tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
      if (class(tmp)[1] == "try-error") 
          stop("X must be a matrix or able to be coerced to a matrix")
  }
   --- R stacktrace ---
  where 1 at testthat/test.R#24: rbridge(X, y, q = 1, R1.mat, r1.vec)
  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(NULL, exprs, env)
  where 13: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 14: force(code)
  where 15: doWithOneRestart(return(expr), restart)
  where 16: withOneRestart(expr, restarts[[1L]])
  where 17: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 18: 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 19: FUN(X[[i]], ...)
  where 20: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 21: force(code)
  where 22: doWithOneRestart(return(expr), restart)
  where 23: withOneRestart(expr, restarts[[1L]])
  where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 25: 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 26: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 27: 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 28: 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 29: test_check("rbridge")
  
   --- value of length: 2 type: logical ---
  [1] FALSE  TRUE
   --- function from context --- 
  function (X, y, q = 1, R, r, lambda.min = ifelse(n > p, 0.001, 
      0.05), nlambda = 100, lambda, eta = 1e-07, converge = 10^10) 
  {
      if (class(X) != "matrix") {
          tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
          if (class(tmp)[1] == "try-error") 
              stop("X must be a matrix or able to be coerced to a matrix")
      }
      if (storage.mode(X) == "integer") 
          storage.mode(X) <- "double"
      if (class(y) != "numeric") {
          tmp <- try(y <- as.numeric(y), silent = TRUE)
          if (class(tmp)[1] == "try-error") 
              stop("y must numeric or able to be coerced to numeric")
      }
      if (nlambda < 2) 
          stop("nlambda must be at least 2")
      if (q > 2) 
          stop("a must be less than 2; choose a small positive number instead")
      if (any(is.na(y)) | any(is.na(X))) 
          stop("Missing data (NA's) detected.  Take actions (e.g., removing cases, removing features, imputation) to eliminate missing data before passing X and y to ncvreg")
      if (length(y) != nrow(X)) 
          stop("X and y do not have the same number of observations")
      stdX <- standard(X)
      XX <- stdX$xx
      p <- ncol(XX)
      ns <- c(1:p)
      yy <- y - mean(y)
      n <- length(yy)
      if (missing(lambda)) {
          lambda <- Lambdas_Grid(XX, yy, q, lambda.min, nlambda)
          user.lambda <- FALSE
      }
      else {
          nlambda <- length(lambda)
          user.lambda <- TRUE
      }
      fit <- RBridge(XX, yy, q, lambda, R, r, converge, eta)
      constant <- rep(mean(y), nlambda)
      betas <- matrix(fit, p, nlambda)
      unbetas <- matrix(0, nrow = (ncol(X) + 1), ncol = length(lambda))
      bbetas <- betas/as.vector(stdX$s)
      unbetas[ns + 1, ] <- bbetas
      unbetas[1, ] <- constant - crossprod(as.vector(stdX$c), bbetas)
      varnames <- if (is.null(colnames(X))) 
          paste("V", 1:ncol(X), sep = "")
      else colnames(X)
      varnames <- c("(Intercept)", varnames)
      dimnames(unbetas) <- list(varnames, lambda)
      output <- structure(list(betas = unbetas, lambda = lambda), 
          class = "rbridge")
      output
  }
  <bytecode: 0x5585dfd7f280>
  <environment: namespace:rbridge>
   --- function search by body ---
  Function rbridge in namespace rbridge has this body.
   ----------- END OF FAILURE REPORT -------------- 
  ── 1. Error: (unknown) (@test.R#24)  ───────────────────────────────────────────
  the condition has length > 1
  Backtrace:
   1. rbridge::rbridge(X, y, q = 1, R1.mat, r1.vec)
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  [ OK: 0 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 1 ]
  1. Error: (unknown) (@test.R#24) 
  
  Error: testthat unit tests failed
  Execution halted