Running ‘testthat.R’ [6s/9s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(PCMBase)
  > 
  > test_check("PCMBase")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  PCMBase
   --- call from context --- 
  PCMLik.GaussianPCM(traits.ab.123[, 1:PCMTreeNumTips(tree.ab)], 
      tree.ab, model_MixedGaussian_ab)
   --- call from argument --- 
  if (class(loglik) == "try-error") {
      err <- paste0("GaussianPCM.R:PCMLik:: There was a problem calculating loglik from X0 and the coefficients L,m,r. ", 
          "X0=", toString(X0), "L0=", toString(L0), "; m0=", toString(m0), 
          "; r0=", r0, ". Error message from call to X0 %*% L0 %*% X0 + m0 %*% X0 + r0:", 
          loglik, "\n")
      errL <- PCMParseErrorMessage(err)
      if (getOption("PCMBase.Raise.Lik.Errors", TRUE)) {
          if (getOption("PCMBase.Errors.As.Warnings", TRUE)) {
              warning(err)
          }
          else {
              stop(err)
          }
      }
      attr(value.NA, "X0") <- X0
      attr(value.NA, "error") <- errL
      return(value.NA)
  }
   --- R stacktrace ---
  where 1: PCMLik.GaussianPCM(traits.ab.123[, 1:PCMTreeNumTips(tree.ab)], 
      tree.ab, model_MixedGaussian_ab)
  where 2: PCMLik(traits.ab.123[, 1:PCMTreeNumTips(tree.ab)], tree.ab, model_MixedGaussian_ab)
  where 3: eval_bare(expr, quo_get_env(quo))
  where 4: quasi_label(enquo(object), label, arg = "object")
  where 5: expect_equal(PCMLik(traits.ab.123[, 1:PCMTreeNumTips(tree.ab)], 
      tree.ab, model_MixedGaussian_ab), PCMLik(traits.ab.123[, 
      1:PCMTreeNumTips(tree.ab)], tree.ab, model.ab.123))
  where 6: eval(code, test_env)
  where 7: eval(code, test_env)
  where 8: 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 9: doTryCatch(return(expr), name, parentenv, handler)
  where 10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 11: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 14: tryCatchList(expr, classes, parentenv, handlers)
  where 15: 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 16: test_code(desc, code, env = parent.frame())
  where 17 at testthat/test-MixedGaussian.R#152: test_that("Equal OU and MixedGaussian likelihoods", expect_equal(PCMLik(traits.ab.123[, 
      1:PCMTreeNumTips(tree.ab)], tree.ab, model_MixedGaussian_ab), 
      PCMLik(traits.ab.123[, 1:PCMTreeNumTips(tree.ab)], tree.ab, 
          model.ab.123)))
  where 18: eval(code, test_env)
  where 19: eval(code, test_env)
  where 20: 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 21: doTryCatch(return(expr), name, parentenv, handler)
  where 22: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 23: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 26: tryCatchList(expr, classes, parentenv, handlers)
  where 27: 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 28: test_code(NULL, exprs, env)
  where 29: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 30: force(code)
  where 31: doWithOneRestart(return(expr), restart)
  where 32: withOneRestart(expr, restarts[[1L]])
  where 33: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 34: 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 35: FUN(X[[i]], ...)
  where 36: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 37: force(code)
  where 38: doWithOneRestart(return(expr), restart)
  where 39: withOneRestart(expr, restarts[[1L]])
  where 40: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 41: 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 42: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 43: 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 44: 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 45: test_check("PCMBase")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (X, tree, model, SE = matrix(0, PCMNumTraits(model), 
      PCMTreeNumTips(tree)), metaI = PCMInfo(X = X, tree = tree, 
      model = model, SE = SE, verbose = verbose), log = TRUE, verbose = FALSE) 
  {
      if (is.Transformable(model)) {
          model <- PCMApplyTransformation(model)
      }
      if (is.function(metaI)) {
          metaI <- metaI(X = X, tree = tree, model = model, SE = SE, 
              verbose = verbose)
      }
      value.NA <- getOption("PCMBase.Value.NA", as.double(NA))
      PCMLmr <- try(PCMLmr(X = X, tree = tree, model = model, SE = SE, 
          metaI = metaI, verbose = verbose, root.only = TRUE), 
          silent = TRUE)
      if (class(PCMLmr) == "try-error") {
          errL <- PCMParseErrorMessage(PCMLmr)
          if (is.null(errL)) {
              err <- paste0("GaussianPCM.R:PCMLik:: There was a problem calculating the coefficients L,m,r. Error message from call to PCMLmr: ", 
                  PCMLmr, "; print(model):", do.call(paste, c(as.list(capture.output(print(model))), 
                    list(sep = "\n"))))
              errL <- PCMParseErrorMessage(err)
          }
          else {
              err <- PCMLmr
          }
          if (getOption("PCMBase.Raise.Lik.Errors", TRUE)) {
              if (getOption("PCMBase.Errors.As.Warnings", TRUE)) {
                  warning(err)
              }
              else {
                  stop(err)
              }
          }
          k0 <- metaI$pc[, metaI$N + 1L]
          X0 <- rep(NaN, metaI$k)
          X0[k0] <- model$X0[k0]
          attr(value.NA, "X0") <- X0
          attr(value.NA, "error") <- errL
          return(value.NA)
      }
      else if (is.list(PCMLmr)) {
          L0 <- as.matrix(PCMLmr$L)
          m0 <- PCMLmr$m
          r0 <- PCMLmr$r
          k0 <- metaI$pc[, metaI$N + 1L]
          if (is.null(L0) | is.null(m0) | is.null(r0)) {
              err <- paste0("GaussianPCM.R:PCMLik:: The list returned by PCMLmr did not contain elements 'L', 'm' and 'r'.")
              if (!getOption("PCMBase.Ignore.Lmr.Errors", FALSE)) {
                  if (getOption("PCMBase.Errors.As.Warnings", TRUE)) {
                    warning(err)
                  }
                  else {
                    stop(err)
                  }
              }
              errL <- PCMParseErrorMessage(err)
              k0 <- metaI$pc[, metaI$N + 1L]
              X0 <- rep(NaN, metaI$k)
              X0[k0] <- model$X0[k0]
              attr(value.NA, "X0") <- X0
              attr(value.NA, "error") <- errL
              return(value.NA)
          }
          if (is.null(model$X0) || isTRUE(all(is.na(model$X0)))) {
              X0 <- rep(NaN, metaI$k)
              X0[k0] <- rep(NA_real_, sum(k0))
              X0[k0] <- try(solve(a = L0[k0, k0, drop = FALSE] + 
                  t(L0[k0, k0, drop = FALSE]), b = -m0[k0]), silent = TRUE)
              if (class(X0[[1]]) == "try-error") {
                  err <- paste0("GaussianPCM.R:PCMLik:: There was a problem calculating X0 from L0,m0,r0. ", 
                    "L0=", toString(L0), "; m0=", toString(m0), 
                    "; r0=", r0, ". Error message:", X0[[1]], "\n")
                  errL <- PCMParseErrorMessage(err)
                  if (getOption("PCMBase.Raise.Lik.Errors", TRUE)) {
                    if (getOption("PCMBase.Errors.As.Warnings", 
                      TRUE)) {
                      warning(err)
                    }
                    else {
                      stop(err)
                    }
                  }
                  X0 <- NULL
                  attr(value.NA, "X0") <- X0
                  attr(value.NA, "error") <- errL
                  return(value.NA)
              }
          }
          else {
              k0 <- metaI$pc[, metaI$N + 1L]
              X0 <- rep(NaN, metaI$k)
              X0[k0] <- model$X0[k0]
          }
          loglik <- try(X0[k0] %*% L0[k0, k0, drop = FALSE] %*% 
              X0[k0] + m0[k0] %*% X0[k0] + r0, silent = TRUE)
          if (class(loglik) == "try-error") {
              err <- paste0("GaussianPCM.R:PCMLik:: There was a problem calculating loglik from X0 and the coefficients L,m,r. ", 
                  "X0=", toString(X0), "L0=", toString(L0), "; m0=", 
                  toString(m0), "; r0=", r0, ". Error message from call to X0 %*% L0 %*% X0 + m0 %*% X0 + r0:", 
                  loglik, "\n")
              errL <- PCMParseErrorMessage(err)
              if (getOption("PCMBase.Raise.Lik.Errors", TRUE)) {
                  if (getOption("PCMBase.Errors.As.Warnings", TRUE)) {
                    warning(err)
                  }
                  else {
                    stop(err)
                  }
              }
              attr(value.NA, "X0") <- X0
              attr(value.NA, "error") <- errL
              return(value.NA)
          }
          value <- try(as.vector(if (log) 
              loglik
          else exp(loglik)), silent = TRUE)
          if (class(value) == "try-error") {
              err <- paste0("GaussianPCM.R:PCMLik:: There was a problem calculating value from loglik=", 
                  toString(loglik), ". Error message from call to as.vector(if(log) loglik else exp(loglik)):", 
                  value, "; print(model):", do.call(paste, c(as.list(capture.output(print(model))), 
                    list(sep = "\n"))))
              errL <- PCMParseErrorMessage(err)
              if (getOption("PCMBase.Raise.Lik.Errors", TRUE)) {
                  if (getOption("PCMBase.Errors.As.Warnings", TRUE)) {
                    warning(err)
                  }
                  else {
                    stop(err)
                  }
              }
              attr(value.NA, "X0") <- X0
              attr(value.NA, "error") <- errL
              return(value.NA)
          }
          else if (is.na(value)) {
              err <- paste0("GaussianPCM.R:PCMLik:: There was a possible numerical problem, e.g. division of 0 by 0 when calculating the likelihood. value=", 
                  toString(value), "; calculated loglik=", toString(loglik), 
                  "; print(model):", do.call(paste, c(as.list(capture.output(print(model))), 
                    list(sep = "\n"))), ". No error message was returned from the call to PCMLmr. Check for runtime warnings.")
              errL <- PCMParseErrorMessage(err)
              if (getOption("PCMBase.Errors.As.Warnings", TRUE)) {
                  warning(err)
              }
              else {
                  stop(err)
              }
              attr(value.NA, "X0") <- X0
              attr(value.NA, "error") <- errL
              return(value.NA)
          }
          attr(value, "X0") <- X0
          return(value)
      }
  }
  <bytecode: 0x55701f682508>
  <environment: namespace:PCMBase>
   --- function search by body ---
  Function PCMLik.GaussianPCM in namespace PCMBase has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1