Running ‘spelling.R’ [0s/1s]
  Running ‘testthat.R’ [44s/68s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(insight)
  > 
  > if (length(strsplit(packageDescription("insight")$Version, "\\.")[[1]]) > 3) {
  +   Sys.setenv("RunAllinsightTests" = "yes")
  + } else {
  +   Sys.setenv("RunAllinsightTests" = "no")
  + }
  > 
  > test_check("insight")
  GAM s.wam loop 1: deviance = 66.42095 
  GAM s.wam loop 2: deviance = 63.77252 
  GAM s.wam loop 3: deviance = 63.25199 
  GAM s.wam loop 4: deviance = 63.13399 
  GAM s.wam loop 5: deviance = 63.11016 
  GAM s.wam loop 6: deviance = 63.10748 
  GAM s.wam loop 7: deviance = 63.10727 
  GAM s.wam loop 8: deviance = 63.10725 
  GAM s.wam loop 9: deviance = 63.10725 
  Gu & Wahba 4 term additive model
  GAMLSS-RS iteration 1: Global Deviance = 4771.925 
  GAMLSS-CG iteration 1: Global Deviance = 4771.013 
  GAMLSS-CG iteration 2: Global Deviance = 4770.994 
  GAMLSS-CG iteration 3: Global Deviance = 4770.994 
  Gu & Wahba 4 term additive model
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  insight
   --- call from context --- 
  .prepare_get_data(x, mf)
   --- call from argument --- 
  if (class(mf_matrix[[1]]) == "rms") class(mf_matrix[[1]]) <- "matrix"
   --- R stacktrace ---
  where 1: .prepare_get_data(x, mf)
  where 2: get_data.default(x)
  where 3: get_data(x)
  where 4: get_response(m1)
  where 5: eval_bare(expr, quo_get_env(quo))
  where 6: quasi_label(enquo(object), label, arg = "object")
  where 7 at testthat/test-gamm4.R#37: expect_equal(get_response(m1), unname(dat$y[, 1]))
  where 8: eval(code, test_env)
  where 9: eval(code, test_env)
  where 10: 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 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 13: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 14: doTryCatch(return(expr), name, parentenv, handler)
  where 15: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 16: tryCatchList(expr, classes, parentenv, handlers)
  where 17: 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 18: test_code(desc, code, env = parent.frame())
  where 19 at testthat/test-gamm4.R#36: test_that("get_response", {
      expect_equal(get_response(m1), unname(dat$y[, 1]))
  })
  where 20: eval(code, test_env)
  where 21: eval(code, test_env)
  where 22: 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 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 25: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 26: doTryCatch(return(expr), name, parentenv, handler)
  where 27: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 28: tryCatchList(expr, classes, parentenv, handlers)
  where 29: 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 30: test_code(NULL, exprs, env)
  where 31: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 32: force(code)
  where 33: doWithOneRestart(return(expr), restart)
  where 34: withOneRestart(expr, restarts[[1L]])
  where 35: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 36: 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 37: FUN(X[[i]], ...)
  where 38: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 39: force(code)
  where 40: doWithOneRestart(return(expr), restart)
  where 41: withOneRestart(expr, restarts[[1L]])
  where 42: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 43: 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 44: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 45: 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 46: 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 47: test_check("insight")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (x, mf, effects = "fixed") 
  {
      if (.is_empty_object(mf)) {
          warning("Could not get model data.", call. = F)
          return(NULL)
      }
      mw <- NULL
      if ("(offset)" %in% colnames(mf) && .obj_has_name(x, "call") && 
          .obj_has_name(x$call, "offset")) {
          offcol <- which(colnames(mf) == "(offset)")
          colnames(mf)[offcol] <- clean_names(.safe_deparse(x$call$offset))
      }
      mf[] <- lapply(mf, function(.x) {
          if (is.matrix(.x) && dim(.x)[2] == 1 && !inherits(.x, 
              c("ns", "bs"))) {
              as.vector(.x)
          }
          else {
              .x
          }
      })
      mc <- sapply(mf, is.matrix)
      rn <- find_response(x, combine = TRUE)
      rn_not_combined <- find_response(x, combine = FALSE)
      trials.data <- NULL
      if (mc[1] && rn == colnames(mf)[1]) {
          mc[1] <- FALSE
          if (inherits(x, c("coxph", "flexsurvreg", "coxme", "survreg", 
              "survfit", "crq", "psm"))) {
              mf <- cbind(mf[[1]][, 1], mf[[1]][, 2], mf)
              colnames(mf)[1:2] <- rn_not_combined
          }
          else {
              tryCatch({
                  trials.data <- as.data.frame(mf[[1]])
                  colnames(trials.data) <- rn_not_combined
                  pattern <- sprintf("%s(\\s*)-(\\s*)%s", rn_not_combined[2], 
                    rn_not_combined[1])
                  if (grepl(pattern = pattern, x = rn)) {
                    trials.data[[2]] <- trials.data[[1]] + trials.data[[2]]
                  }
              }, error = function(x) {
                  NULL
              })
          }
      }
      if (any(mc)) {
          md <- tryCatch({
              eval(stats::getCall(x)$data, environment(stats::formula(x)))
          }, error = function(x) {
              NULL
          })
          if (is.null(md)) {
              mf_matrix <- mf[, which(mc), drop = FALSE]
              mf_nonmatrix <- mf[, -which(mc), drop = FALSE]
              if (class(mf_matrix[[1]]) == "rms") 
                  class(mf_matrix[[1]]) <- "matrix"
              mf_list <- lapply(mf_matrix, as.data.frame, stringsAsFactors = FALSE)
              mf_matrix <- do.call(cbind, mf_list)
              mf <- cbind(mf_nonmatrix, mf_matrix)
          }
          else {
              if (any(is.na(colnames(md)))) 
                  colnames(md) <- make.names(colnames(md))
              mf_matrix <- mf[, -which(mc), drop = FALSE]
              spline.term <- clean_names(names(which(mc)))
              other.terms <- clean_names(colnames(mf_matrix))[-1]
              needed.vars <- c(other.terms, spline.term)
              if (is.matrix(mf[[1]])) {
                  needed.vars <- c(dimnames(mf[[1]])[[2]], needed.vars)
              }
              else {
                  needed.vars <- c(colnames(mf)[1], needed.vars)
              }
              if ("(weights)" %in% needed.vars && !.obj_has_name(md, 
                  "(weights)")) {
                  needed.vars <- needed.vars[-which(needed.vars == 
                    "(weights)")]
                  mw <- mf[["(weights)"]]
              }
              if (inherits(x, c("coxph", "coxme"))) {
                  mf <- md
              }
              else {
                  needed.vars <- unique(clean_names(needed.vars))
                  mf <- md[, needed.vars, drop = FALSE]
                  value_labels <- lapply(mf, function(.l) attr(.l, 
                    "labels", exact = TRUE))
                  variable_labels <- lapply(mf, function(.l) attr(.l, 
                    "label", exact = TRUE))
                  mf <- stats::na.omit(mf)
                  mf <- as.data.frame(mapply(function(.d, .l) {
                    attr(.d, "labels") <- .l
                    .d
                  }, mf, value_labels, SIMPLIFY = FALSE), stringsAsFactors = FALSE)
                  mf <- as.data.frame(mapply(function(.d, .l) {
                    attr(.d, "label") <- .l
                    .d
                  }, mf, variable_labels, SIMPLIFY = FALSE), stringsAsFactors = FALSE)
              }
              if (!is.null(mw)) 
                  mf$`(weights)` <- mw
          }
          pv <- tryCatch({
              find_predictors(x, effects = effects, flatten = TRUE)
          }, error = function(x) {
              NULL
          })
          if (!is.null(pv) && !all(pv %in% colnames(mf))) {
              warning("Some model terms could not be found in model data. You probably need to load the data into the environment.", 
                  call. = FALSE)
          }
      }
      mos_eisly <- grepl(pattern = "^mo\\(([^,)]*).*", x = colnames(mf))
      if (any(mos_eisly)) 
          mf <- mf[!mos_eisly]
      cvn <- .remove_pattern_from_names(colnames(mf), ignore_lag = TRUE)
      if (colnames(mf)[1] == rn[1] && grepl("^I\\(", rn[1])) {
          md <- tryCatch({
              tmp <- .get_data_from_env(x)[, unique(c(rn_not_combined, 
                  cvn)), drop = FALSE]
              tmp[, rn_not_combined, drop = FALSE]
          }, error = function(x) {
              NULL
          })
          if (!is.null(md)) {
              mf <- cbind(mf, md)
              cvn <- .remove_pattern_from_names(colnames(mf), ignore_lag = TRUE)
              cvn[1] <- rn[1]
          }
      }
      dupes <- which(duplicated(cvn))
      if (!.is_empty_string(dupes)) 
          cvn[dupes] <- sprintf("%s.%s", cvn[dupes], 1:length(dupes))
      colnames(mf) <- cvn
      weighting_var <- find_weights(x)
      if (!is.null(weighting_var) && !weighting_var %in% colnames(mf) && 
          length(weighting_var) == 1) {
          mf <- tryCatch({
              tmp <- cbind(mf, get_weights(x))
              colnames(tmp)[ncol(tmp)] <- weighting_var
              tmp
          }, error = function(e) {
              mf
          })
      }
      if (!is.null(trials.data)) {
          new.cols <- setdiff(colnames(trials.data), colnames(mf))
          if (!.is_empty_string(new.cols)) 
              mf <- cbind(mf, trials.data[, new.cols, drop = FALSE])
      }
      mf
  }
  <bytecode: 0x56205c819a30>
  <environment: namespace:insight>
   --- function search by body ---
  Function .prepare_get_data in namespace insight has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1