CRAN Package Check Results for Package PCMBase

Last updated on 2019-12-13 10:49:40 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.2.10 24.06 190.97 215.03 ERROR
r-devel-linux-x86_64-debian-gcc 1.2.10 20.75 179.76 200.51 OK
r-devel-linux-x86_64-fedora-clang 1.2.11 323.78 OK
r-devel-linux-x86_64-fedora-gcc 1.2.11 303.38 OK
r-devel-windows-ix86+x86_64 1.2.10 40.00 188.00 228.00 OK
r-devel-windows-ix86+x86_64-gcc8 1.2.10 36.00 269.00 305.00 OK
r-patched-linux-x86_64 1.2.10 20.61 206.88 227.49 OK
r-patched-solaris-x86 1.2.11 327.10 OK
r-release-linux-x86_64 1.2.10 19.39 206.91 226.30 OK
r-release-windows-ix86+x86_64 1.2.10 32.00 174.00 206.00 OK
r-release-osx-x86_64 1.2.10 WARN
r-oldrel-windows-ix86+x86_64 1.2.10 27.00 163.00 190.00 OK
r-oldrel-osx-x86_64 1.2.10 WARN

Check Details

Version: 1.2.10
Check: examples
Result: ERROR
    Running examples in 'PCMBase-Ex.R' failed
    The error most likely occurred in:
    
    > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
    > ### Name: PCM
    > ### Title: Create a phylogenetic comparative model object
    > ### Aliases: PCM
    >
    > ### ** Examples
    >
    > # a Brownian motion model with one regime
    > modelBM <- PCM(model = "BM", k = 2)
    > # print the model
    > modelBM
    Brownian motion model
    S3 class: BM, GaussianPCM, PCM; k=2; p=8; regimes: 1. Parameters/sub-models:
    X0 (VectorParameter, _Global, numeric; trait values at the root):
    [1] 0 0
    Sigma_x (MatrixParameter, _UpperTriangularWithDiagonal, _WithNonNegativeDiagonal; factor of the unit-time variance rate):
    , , 1
    
     [,1] [,2]
    [1,] 0 0
    [2,] 0 0
    
    Sigmae_x (MatrixParameter, _UpperTriangularWithDiagonal, _WithNonNegativeDiagonal; factor of the non-heritable variance or the variance of the measurement error):
    , , 1
    
     [,1] [,2]
    [1,] 0 0
    [2,] 0 0
    
    
    >
    > # a BM model with two regimes
    > modelBM.ab <- PCM("BM", k = 2, regimes = c("a", "b"))
    > modelBM.ab
    Brownian motion model
    S3 class: BM, GaussianPCM, PCM; k=2; p=14; regimes: a, b. Parameters/sub-models:
    X0 (VectorParameter, _Global, numeric; trait values at the root):
    [1] 0 0
    Sigma_x (MatrixParameter, _UpperTriangularWithDiagonal, _WithNonNegativeDiagonal; factor of the unit-time variance rate):
    , , a
    
     [,1] [,2]
    [1,] 0 0
    [2,] 0 0
    
    , , b
    
     [,1] [,2]
    [1,] 0 0
    [2,] 0 0
    
    Sigmae_x (MatrixParameter, _UpperTriangularWithDiagonal, _WithNonNegativeDiagonal; factor of the non-heritable variance or the variance of the measurement error):
    , , a
    
     [,1] [,2]
    [1,] 0 0
    [2,] 0 0
    
    , , b
    
     [,1] [,2]
    [1,] 0 0
    [2,] 0 0
    
    
    >
    > # print a single parameter of the model (in this case, the root value)
    > modelBM.ab$X0
    [1] 0 0
    attr(,"class")
    [1] "VectorParameter" "_Global" "numeric"
    attr(,"description")
    [1] "trait values at the root"
    >
    > # assign a value to this parameter (note that the brackets [] are necessary
    > # to preserve the parameter attributes):
    > modelBM.ab$X0[] <- c(5, 2)
    >
    > PCMNumTraits(modelBM)
    [1] 2
    > PCMNumRegimes(modelBM)
    [1] 1
    > PCMNumRegimes(modelBM.ab)
    [1] 2
    >
    > # number of numerical parameters in the model
    > PCMParamCount(modelBM)
    [1] 8
    >
    > # Get a vector representation of all parameters in the model
    > PCMParamGetShortVector(modelBM)
    [1] 0 0 0 0 0 0 0 0
    >
    > # Limits for the model parameters:
    > lowerLimit <- PCMParamLowerLimit(modelBM)
    > upperLimit <- PCMParamUpperLimit(modelBM)
    >
    > # assign the model parameters at random: this will use uniform distribution
    > # with boundaries specified by PCMParamLowerLimit and PCMParamUpperLimit
    > # We do this in two steps:
    > # 1. First we generate a random vector. Note the length of the vector equals PCMParamCount(modelBM)
    > randomParams <- PCMParamRandomVecParams(modelBM, PCMNumTraits(modelBM), PCMNumRegimes(modelBM))
    > randomParams
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
    [1,] -4.689827 -2.557522 5.728534 8.164156 2.016819 8.983897 8.893505 6.607978
    > # 2. Then we load this random vector into the model.
    > PCMParamLoadOrStore(modelBM, randomParams, 0, PCMNumTraits(modelBM), PCMNumRegimes(modelBM), TRUE)
    [1] 8
    >
    > print(modelBM)
    Brownian motion model
    S3 class: BM, GaussianPCM, PCM; k=2; p=8; regimes: 1. Parameters/sub-models:
    X0 (VectorParameter, _Global, numeric; trait values at the root):
    [1] -4.689827 -2.557522
    Sigma_x (MatrixParameter, _UpperTriangularWithDiagonal, _WithNonNegativeDiagonal; factor of the unit-time variance rate):
    , , 1
    
     [,1] [,2]
    [1,] 5.728534 8.164156
    [2,] 0.000000 2.016819
    
    Sigmae_x (MatrixParameter, _UpperTriangularWithDiagonal, _WithNonNegativeDiagonal; factor of the non-heritable variance or the variance of the measurement error):
    , , 1
    
     [,1] [,2]
    [1,] 8.983897 8.893505
    [2,] 0.000000 6.607978
    
    
    >
    > PCMParamGetShortVector(modelBM)
    [1] -4.689827 -2.557522 5.728534 8.164156 2.016819 8.983897 8.893505
    [8] 6.607978
    >
    > # generate a random phylogenetic tree of 10 tips
    > tree <- ape::rtree(10)
    >
    > #simulate the model on the tree
    > traitValues <- PCMSim(tree, modelBM, X0 = modelBM$X0)
    >
    > # calculate the likelihood for the model parameters, given the tree and the trait values
    > PCMLik(traitValues, tree, modelBM)
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    PCMBase
     --- call from context ---
    PCMLik.GaussianPCM(traitValues, tree, modelBM)
     --- 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(traitValues, tree, modelBM)
    where 2: PCMLik(traitValues, tree, modelBM)
    
     --- 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: 0xd6952c0>
    <environment: namespace:PCMBase>
     --- function search by body ---
    Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
    Error in if (class(loglik) == "try-error") { :
     the condition has length > 1
    Calls: PCMLik -> PCMLik.GaussianPCM
    Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 1.2.10
Check: tests
Result: ERROR
     Running 'testthat.R' [20s/21s]
    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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 1. Error: Equal OU and MixedGaussian likelihoods ---------------------------
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equal(...)
     5. PCMBase:::PCMLik.GaussianPCM(...)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.ab.123, tree.ab, model_MixedGaussian_ab_globalSigmae_x)
     --- 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, tree.ab, model_MixedGaussian_ab_globalSigmae_x)
     where 2: PCMLik(traits.ab.123, tree.ab, model_MixedGaussian_ab_globalSigmae_x)
     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, tree.ab, model_MixedGaussian_ab_globalSigmae_x),
     PCMLik(traits.ab.123, tree.ab, model.ab.123.bSigmae_x))
     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#158: test_that("Equal OU and MixedGaussian likelihoods with global Sigmae_x",
     expect_equal(PCMLik(traits.ab.123, tree.ab, model_MixedGaussian_ab_globalSigmae_x),
     PCMLik(traits.ab.123, tree.ab, model.ab.123.bSigmae_x)))
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 2. Error: Equal OU and MixedGaussian likelihoods with global Sigmae_x ------
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equal(...)
     5. PCMBase:::PCMLik.GaussianPCM(traits.ab.123, tree.ab, model_MixedGaussian_ab_globalSigmae_x)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123.BM)
     --- 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.a.123, tree.a, model.a.123.BM)
     where 2: PCMLik(traits.a.123, tree.a, model.a.123.BM)
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-BM.R#37: expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM),
     dmvnorm(as.vector(traits.a.123[, 1:PCMTreeNumTips(tree.a)]),
     as.vector(PCMMean(tree.a, model.a.123.BM, model.a.123.BM$X0)),
     PCMVar(tree.a, model.a.123.BM), log = TRUE))
     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-PCMLik-BM.R#32: test_that("Equal likelihood with dmvnorm on a random model, single regime (a)",
     {
     expect_silent(model.a.123.BM <- PCM("BM", k = 3, regimes = "a"))
     expect_silent(PCMParamLoadOrStore(model.a.123.BM, PCMParamRandomVecParams(model.a.123.BM),
     offset = 0, k = 3, load = TRUE))
     expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM),
     dmvnorm(as.vector(traits.a.123[, 1:PCMTreeNumTips(tree.a)]),
     as.vector(PCMMean(tree.a, model.a.123.BM, model.a.123.BM$X0)),
     PCMVar(tree.a, model.a.123.BM), log = TRUE))
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 3. Error: Equal likelihood with dmvnorm on a random model, single regime (a)
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equivalent(...)
     5. PCMBase:::PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123.BM)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123.BM, SE = abs(0.01 *
     traits.a.123[, seq_len(PCMTreeNumTips(tree.a))]))
     --- 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.a.123, tree.a, model.a.123.BM, SE = abs(0.01 *
     traits.a.123[, seq_len(PCMTreeNumTips(tree.a))]))
     where 2: PCMLik(traits.a.123, tree.a, model.a.123.BM, SE = abs(0.01 *
     traits.a.123[, seq_len(PCMTreeNumTips(tree.a))]))
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-BM.R#50: expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])),
     PCMLikDmvNorm(traits.a.123, tree.a, model.a.123.BM, SE = abs(0.01 *
     traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])))
     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-PCMLik-BM.R#45: test_that("Equal likelihood with dmvnorm on a random model, with single regime (a) and SE >0",
     {
     expect_silent(model.a.123.BM <- PCM("BM", k = 3, regimes = "a"))
     expect_silent(PCMParamLoadOrStore(model.a.123.BM, PCMParamRandomVecParams(model.a.123.BM),
     offset = 0, k = 3, load = TRUE))
     expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])),
     PCMLikDmvNorm(traits.a.123, tree.a, model.a.123.BM,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])))
     expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])),
     {
     dmvnorm(as.vector(traits.a.123[, 1:PCMTreeNumTips(tree.a)]),
     as.vector(PCMMean(tree.a, model.a.123.BM, model.a.123.BM$X0)),
     PCMVar(tree.a, model.a.123.BM) + diag(abs(0.01 *
     as.vector(traits.a.123[, 1:PCMTreeNumTips(tree.a)]))^2),
     log = TRUE)
     })
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 4. Error: Equal likelihood with dmvnorm on a random model, with single regime
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equivalent(...)
     5. PCMBase:::PCMLik.GaussianPCM(...)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.ab.123, tree.ab, model.ab.123.BM)
     --- 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, tree.ab, model.ab.123.BM)
     where 2: PCMLik(traits.ab.123, tree.ab, model.ab.123.BM)
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-BM.R#72: expect_equivalent(PCMLik(traits.ab.123, tree.ab, model.ab.123.BM),
     dmvnorm(as.vector(traits.ab.123[, 1:PCMTreeNumTips(tree.ab)]),
     as.vector(PCMMean(tree.ab, model.ab.123.BM, model.ab.123.BM$X0)),
     PCMVar(tree.ab, model.ab.123.BM), log = TRUE))
     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-PCMLik-BM.R#67: test_that("Equal likelihood with dmvnorm on a random model, multiple regimes (ab)",
     {
     expect_silent(model.ab.123.BM <- PCM("BM", k = 3, regimes = c("a",
     "b")))
     expect_silent(PCMParamLoadOrStore(model.ab.123.BM, PCMParamRandomVecParams(model.ab.123.BM),
     offset = 0, k = 3, load = TRUE))
     expect_equivalent(PCMLik(traits.ab.123, tree.ab, model.ab.123.BM),
     dmvnorm(as.vector(traits.ab.123[, 1:PCMTreeNumTips(tree.ab)]),
     as.vector(PCMMean(tree.ab, model.ab.123.BM, model.ab.123.BM$X0)),
     PCMVar(tree.ab, model.ab.123.BM), log = TRUE))
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 5. Error: Equal likelihood with dmvnorm on a random model, multiple regimes (
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equivalent(...)
     5. PCMBase:::PCMLik.GaussianPCM(traits.ab.123, tree.ab, model.ab.123.BM)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123.BM_drift)
     --- 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.a.123, tree.a, model.a.123.BM_drift)
     where 2: PCMLik(traits.a.123, tree.a, model.a.123.BM_drift)
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-BMdrift.R#37: expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM_drift),
     dmvnorm(as.vector(traits.a.123[, 1:PCMTreeNumTips(tree.a)]),
     as.vector(PCMMean(tree.a, model.a.123.BM_drift, model.a.123.BM_drift$X0)),
     PCMVar(tree.a, model.a.123.BM_drift), log = TRUE))
     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-PCMLik-BMdrift.R#32: test_that("Equal likelihood with dmvnorm on a random model, single regime (a)",
     {
     expect_silent(model.a.123.BM_drift <- PCM("BM_drift",
     k = 3, regimes = "a"))
     expect_silent(PCMParamLoadOrStore(model.a.123.BM_drift,
     PCMParamRandomVecParams(model.a.123.BM_drift), offset = 0,
     k = 3, load = TRUE))
     expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM_drift),
     dmvnorm(as.vector(traits.a.123[, 1:PCMTreeNumTips(tree.a)]),
     as.vector(PCMMean(tree.a, model.a.123.BM_drift,
     model.a.123.BM_drift$X0)), PCMVar(tree.a, model.a.123.BM_drift),
     log = TRUE))
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 6. Error: Equal likelihood with dmvnorm on a random model, single regime (a)
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equivalent(...)
     5. PCMBase:::PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123.BM_drift)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123.BM_drift)
     --- 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.a.123, tree.a, model.a.123.BM_drift)
     where 2: PCMLik(traits.a.123, tree.a, model.a.123.BM_drift)
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-BMdrift.R#58: expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM_drift),
     PCMLik(traits.a.123, tree.a, model.a.123.BM))
     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-PCMLik-BMdrift.R#45: test_that("Equal likelihood with with BM for 0 drift, single regime (a)",
     {
     expect_silent(model.a.123.BM_drift <- PCM("BM_drift",
     k = 3, regimes = "a"))
     expect_silent(model.a.123.BM <- PCM("BM", k = 3, regimes = "a"))
     expect_silent(PCMParamLoadOrStore(model.a.123.BM, PCMParamRandomVecParams(model.a.123.BM),
     offset = 0, k = 3, load = TRUE))
     expect_silent(params_for_BM_drift <- NA)
     expect_silent(PCMParamLoadOrStore(model.a.123.BM, params_for_BM_drift,
     offset = 0, k = 3, load = FALSE))
     expect_silent(params_for_BM_drift <- c(params_for_BM_drift[1:3],
     0, 0, 0, params_for_BM_drift[4:length(params_for_BM_drift)]))
     expect_silent(PCMParamLoadOrStore(model.a.123.BM_drift,
     params_for_BM_drift, offset = 0, k = 3, load = TRUE))
     expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM_drift),
     PCMLik(traits.a.123, tree.a, model.a.123.BM))
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 7. Error: Equal likelihood with with BM for 0 drift, single regime (a) (@test
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equivalent(...)
     5. PCMBase:::PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123.BM_drift)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))]))
     --- 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.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))]))
     where 2: PCMLik(traits.a.123, tree.a, model.a.123.BM_drift, SE = abs(0.01 *
     traits.a.123[, seq_len(PCMTreeNumTips(tree.a))]))
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-BMdrift.R#69: expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])),
     PCMLikDmvNorm(traits.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])))
     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-PCMLik-BMdrift.R#64: test_that("Equal likelihood with dmvnorm on a random model, with single regime (a) and SE >0",
     {
     expect_silent(model.a.123.BM_drift <- PCM("BM_drift",
     k = 3, regimes = "a"))
     expect_silent(PCMParamLoadOrStore(model.a.123.BM_drift,
     PCMParamRandomVecParams(model.a.123.BM_drift), offset = 0,
     k = 3, load = TRUE))
     expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])),
     PCMLikDmvNorm(traits.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])))
     expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])),
     {
     dmvnorm(as.vector(traits.a.123[, 1:PCMTreeNumTips(tree.a)]),
     as.vector(PCMMean(tree.a, model.a.123.BM_drift,
     model.a.123.BM_drift$X0)), PCMVar(tree.a,
     model.a.123.BM_drift) + diag(abs(0.01 * as.vector(traits.a.123[,
     1:PCMTreeNumTips(tree.a)]))^2), log = TRUE)
     })
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 8. Error: Equal likelihood with dmvnorm on a random model, with single regime
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equivalent(...)
     5. PCMBase:::PCMLik.GaussianPCM(...)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))]))
     --- 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.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))]))
     where 2: PCMLik(traits.a.123, tree.a, model.a.123.BM_drift, SE = abs(0.01 *
     traits.a.123[, seq_len(PCMTreeNumTips(tree.a))]))
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-BMdrift.R#102: expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])),
     PCMLik(traits.a.123, tree.a, model.a.123.BM_drift, SE = abs(0.01 *
     traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])))
     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-PCMLik-BMdrift.R#88: test_that("Equal likelihood with BM for 0 drift, with single regime (a) and SE >0",
     {
     expect_silent(model.a.123.BM_drift <- PCM("BM_drift",
     k = 3, regimes = "a"))
     expect_silent(model.a.123.BM <- PCM("BM", k = 3, regimes = "a"))
     expect_silent(PCMParamLoadOrStore(model.a.123.BM_drift,
     PCMParamRandomVecParams(model.a.123.BM_drift), offset = 0,
     k = 3, load = TRUE))
     expect_silent(params_for_BM_drift <- NA)
     expect_silent(PCMParamLoadOrStore(model.a.123.BM_drift,
     params_for_BM_drift, offset = 0, k = 3, load = FALSE))
     expect_silent(params_for_BM_drift <- c(params_for_BM_drift[1:3],
     0, 0, 0, params_for_BM_drift[4:length(params_for_BM_drift)]))
     expect_silent(PCMParamLoadOrStore(model.a.123.BM_drift,
     params_for_BM_drift, offset = 0, k = 3, load = TRUE))
     expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])),
     PCMLik(traits.a.123, tree.a, model.a.123.BM_drift,
     SE = abs(0.01 * traits.a.123[, seq_len(PCMTreeNumTips(tree.a))])))
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 9. Error: Equal likelihood with BM for 0 drift, with single regime (a) and SE
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equivalent(...)
     5. PCMBase:::PCMLik.GaussianPCM(...)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.ab.123, tree.ab, model.ab.123.BM_drift)
     --- 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, tree.ab, model.ab.123.BM_drift)
     where 2: PCMLik(traits.ab.123, tree.ab, model.ab.123.BM_drift)
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-BMdrift.R#114: expect_equivalent(PCMLik(traits.ab.123, tree.ab, model.ab.123.BM_drift),
     dmvnorm(as.vector(traits.ab.123[, 1:PCMTreeNumTips(tree.ab)]),
     as.vector(PCMMean(tree.ab, model.ab.123.BM_drift, model.ab.123.BM_drift$X0)),
     PCMVar(tree.ab, model.ab.123.BM_drift), log = TRUE))
     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-PCMLik-BMdrift.R#109: test_that("Equal likelihood with dmvnorm on a random model, multiple regimes (ab)",
     {
     expect_silent(model.ab.123.BM_drift <- PCM("BM_drift",
     k = 3, regimes = c("a", "b")))
     expect_silent(PCMParamLoadOrStore(model.ab.123.BM_drift,
     PCMParamRandomVecParams(model.ab.123.BM_drift), offset = 0,
     k = 3, load = TRUE))
     expect_equivalent(PCMLik(traits.ab.123, tree.ab, model.ab.123.BM_drift),
     dmvnorm(as.vector(traits.ab.123[, 1:PCMTreeNumTips(tree.ab)]),
     as.vector(PCMMean(tree.ab, model.ab.123.BM_drift,
     model.ab.123.BM_drift$X0)), PCMVar(tree.ab,
     model.ab.123.BM_drift), log = TRUE))
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 10. Error: Equal likelihood with dmvnorm on a random model, multiple regimes
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equivalent(...)
     5. PCMBase:::PCMLik.GaussianPCM(traits.ab.123, tree.ab, model.ab.123.BM_drift)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.ab.123, tree.ab, model.ab.123.BM_drift)
     --- 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, tree.ab, model.ab.123.BM_drift)
     where 2: PCMLik(traits.ab.123, tree.ab, model.ab.123.BM_drift)
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-BMdrift.R#135: expect_equivalent(PCMLik(traits.ab.123, tree.ab, model.ab.123.BM_drift),
     PCMLik(traits.ab.123, tree.ab, model.ab.123.BM))
     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-PCMLik-BMdrift.R#122: test_that("Equal likelihood with BM for 0 drift, multiple regimes (ab)",
     {
     expect_silent(model.ab.123.BM_drift <- PCM("BM_drift",
     k = 3, regimes = c("a", "b")))
     expect_silent(model.ab.123.BM <- PCM("BM", k = 3, regimes = c("a",
     "b")))
     expect_silent(PCMParamLoadOrStore(model.ab.123.BM, PCMParamRandomVecParams(model.ab.123.BM),
     offset = 0, k = 3, load = TRUE))
     expect_silent(params_for_BM_drift <- NA)
     expect_silent(PCMParamLoadOrStore(model.ab.123.BM, params_for_BM_drift,
     offset = 0, k = 3, load = FALSE))
     expect_silent(params_for_BM_drift <- c(params_for_BM_drift[1:3],
     0, 0, 0, 0, 0, 0, params_for_BM_drift[4:length(params_for_BM_drift)]))
     expect_silent(PCMParamLoadOrStore(model.ab.123.BM_drift,
     params_for_BM_drift, offset = 0, k = 3, load = TRUE))
     expect_equivalent(PCMLik(traits.ab.123, tree.ab, model.ab.123.BM_drift),
     PCMLik(traits.ab.123, tree.ab, model.ab.123.BM))
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 11. Error: Equal likelihood with BM for 0 drift, multiple regimes (ab) (@test
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equivalent(...)
     5. PCMBase:::PCMLik.GaussianPCM(traits.ab.123, tree.ab, model.ab.123.BM_drift)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123.DOU)
     --- 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.a.123, tree.a, model.a.123.DOU)
     where 2: PCMLik(traits.a.123, tree.a, model.a.123.DOU)
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-DOU.R#59: expect_true(is.finite(PCMLik(traits.a.123, tree.a, model.a.123.DOU)))
     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-PCMLik-DOU.R#53: test_that("Equal likelihood with dmvnorm on a random model, single regime (a)",
     {
     expect_silent(model.a.123.DOU <- PCM("DOU__Global_X0__Schur_WithNonNegativeDiagonal_Transformable_H1__Schur_WithNonNegativeDiagonal_Transformable_H2__Theta__UpperTriangularWithDiagonal_WithNonNegativeDiagonal_Sigma_x__UpperTriangularWithDiagonal_WithNonNegativeDiagonal_Global_Sigmae_x",
     k = 3, regimes = "a"))
     expect_silent(PCMParamLoadOrStore(model.a.123.DOU, PCMParamRandomVecParams(model.a.123.DOU),
     offset = 0, k = 3, load = TRUE))
     expect_true(is.finite(PCMLik(traits.a.123, tree.a, model.a.123.DOU)))
     expect_true(abs(PCMLik(traits.a.123, tree.a, model.a.123.DOU) -
     PCMLikDmvNorm(traits.a.123, tree.a, model.a.123.DOU)) <
     5)
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 12. Error: Equal likelihood with dmvnorm on a random model, single regime (a)
     the condition has length > 1
     Backtrace:
     1. testthat::expect_true(...)
     5. PCMBase:::PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123.DOU)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.ab.123, tree.ab, model.ab.123.DOU)
     --- 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, tree.ab, model.ab.123.DOU)
     where 2: PCMLik(traits.ab.123, tree.ab, model.ab.123.DOU)
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-DOU.R#71: expect_true(is.finite(PCMLik(traits.ab.123, tree.ab, model.ab.123.DOU)))
     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-PCMLik-DOU.R#65: test_that("Equal likelihood with dmvnorm on a random model, multiple regimes (ab)",
     {
     expect_silent(model.ab.123.DOU <- PCM("DOU__Global_X0__Schur_WithNonNegativeDiagonal_Transformable_H1__Schur_WithNonNegativeDiagonal_Transformable_H2__Theta__UpperTriangularWithDiagonal_WithNonNegativeDiagonal_Sigma_x__UpperTriangularWithDiagonal_WithNonNegativeDiagonal_Global_Sigmae_x",
     k = 3, regimes = c("a", "b")))
     expect_silent(PCMParamLoadOrStore(model.ab.123.DOU, PCMParamRandomVecParams(model.ab.123.DOU),
     offset = 0, k = 3, load = TRUE))
     expect_true(is.finite(PCMLik(traits.ab.123, tree.ab,
     model.ab.123.DOU)))
     expect_true(abs(PCMLik(traits.ab.123, tree.ab, model.ab.123.DOU) -
     PCMLikDmvNorm(traits.ab.123, tree.ab, model.ab.123.DOU)) <
     5)
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 13. Error: Equal likelihood with dmvnorm on a random model, multiple regimes
     the condition has length > 1
     Backtrace:
     1. testthat::expect_true(...)
     5. PCMBase:::PCMLik.GaussianPCM(traits.ab.123, tree.ab, model.ab.123.DOU)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.a.1, tree.a, model.a.1)
     --- 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.a.1, tree.a, model.a.1)
     where 2: PCMLik(traits.a.1, tree.a, model.a.1)
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-OU.R#32: expect_equivalent(PCMLik(traits.a.1, tree.a, model.a.1), -91.015331180479)
     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-PCMLik-OU.R#30: test_that("Single trait log-likelihood, regime a", {
     expect_equivalent(PCMLik(traits.a.1, tree.a, model.a.1),
     -91.015331180479)
     expect_equivalent(PCMLik(traits.a.2, tree.a, model.a.2),
     -60.0600001079255)
     expect_equivalent(PCMLik(traits.a.3, tree.a, model.a.3),
     -527.311935254892)
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 14. Error: Single trait log-likelihood, regime a (@test-PCMLik-OU.R#32) ----
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equivalent(...)
     5. PCMBase:::PCMLik.GaussianPCM(traits.a.1, tree.a, model.a.1)
    
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
     :
     --- package (from environment) ---
     PCMBase
     --- call from context ---
     PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123)
     --- 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.a.123, tree.a, model.a.123)
     where 2: PCMLik(traits.a.123, tree.a, model.a.123)
     where 3: eval_bare(expr, quo_get_env(quo))
     where 4: quasi_label(enquo(object), label, arg = "object")
     where 5 at testthat/test-PCMLik-OU.R#40: expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123),
     -205.993838713138)
     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-PCMLik-OU.R#38: test_that("Triple-trait log-likelihood of independent traits, regime a",
     {
     expect_equivalent(PCMLik(traits.a.123, tree.a, model.a.123),
     -205.993838713138)
     })
     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: 0xbcc0d18>
     <environment: namespace:PCMBase>
     --- function search by body ---
     Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
     -- 15. Error: Triple-trait log-likelihood of independent traits, regime a (@test
     the condition has length > 1
     Backtrace:
     1. testthat::expect_equivalent(...)
     5. PCMBase:::PCMLik.GaussianPCM(traits.a.123, tree.a, model.a.123)
    
     == testthat results ===========================================================
     [ OK: 126 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 15 ]
     1. Error: Equal OU and MixedGaussian likelihoods
     2. Error: Equal OU and MixedGaussian likelihoods with global Sigmae_x
     3. Error: Equal likelihood with dmvnorm on a random model, single regime (a) (@test-PCMLik-BM.R#37)
     4. Error: Equal likelihood with dmvnorm on a random model, with single regime (a) and SE >0 (@test-PCMLik-BM.R#50)
     5. Error: Equal likelihood with dmvnorm on a random model, multiple regimes (ab) (@test-PCMLik-BM.R#72)
     6. Error: Equal likelihood with dmvnorm on a random model, single regime (a) (@test-PCMLik-BMdrift.R#37)
     7. Error: Equal likelihood with with BM for 0 drift, single regime (a) (@test-PCMLik-BMdrift.R#58)
     8. Error: Equal likelihood with dmvnorm on a random model, with single regime (a) and SE >0 (@test-PCMLik-BMdrift.R#69)
     9. Error: Equal likelihood with BM for 0 drift, with single regime (a) and SE >0 (@test-PCMLik-BMdrift.R#102)
     1. ...
    
     Error: testthat unit tests failed
     Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 1.2.10
Check: re-building of vignette outputs
Result: WARN
    Error(s) in re-building vignettes:
     ...
    --- re-building 'PCMBase.Rmd' using rmarkdown
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    PCMBase
     --- call from context ---
    PCMLik.GaussianPCM(traits, tree.ab, modelBM.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, tree.ab, modelBM.ab)
    where 2: PCMLik(traits, tree.ab, modelBM.ab)
    where 3: eval(expr, envir, enclos)
    where 4: eval(expr, envir, enclos)
    where 5: withVisible(eval(expr, envir, enclos))
    where 6: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
     error = eHandler, message = mHandler)
    where 7: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
     enclos)), warning = wHandler, error = eHandler, message = mHandler))
    where 8: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
    where 9: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
     debug = debug, last = i == length(out), use_try = stop_on_error !=
     2L, keep_warning = keep_warning, keep_message = keep_message,
     output_handler = output_handler, include_timing = include_timing)
    where 10: evaluate::evaluate(...)
    where 11: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
     keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
     options$include) 0L else 2L, output_handler = knit_handlers(options$render,
     options))
    where 12: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
     keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
     stop_on_error = if (options$error && options$include) 0L else 2L,
     output_handler = knit_handlers(options$render, options)))
    where 13: block_exec(params)
    where 14: call_block(x)
    where 15: process_group.block(group)
    where 16: process_group(group)
    where 17: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
     error = function(e) {
     setwd(wd)
     cat(res, sep = "\n", file = output %n% "")
     message("Quitting from lines ", paste(current_lines(i),
     collapse = "-"), " (", knit_concord$get("infile"),
     ") ")
     })
    where 18: process_file(text, output)
    where 19: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet,
     encoding = encoding)
    where 20: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
     ...)
    where 21: vweave_rmarkdown(...)
    where 22: engine$weave(file, quiet = quiet, encoding = enc)
    where 23: doTryCatch(return(expr), name, parentenv, handler)
    where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
    where 25: tryCatchList(expr, classes, parentenv, handlers)
    where 26: tryCatch({
     engine$weave(file, quiet = quiet, encoding = enc)
     setwd(startdir)
     output <- find_vignette_product(name, by = "weave", engine = engine)
     if (!have.makefile && vignette_is_tex(output)) {
     texi2pdf(file = output, clean = FALSE, quiet = quiet)
     output <- find_vignette_product(name, by = "texi2pdf",
     engine = engine)
     }
    }, error = function(e) {
     OK <<- FALSE
     message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
     file, conditionMessage(e)))
    })
    where 27: tools:::.buildOneVignette("PCMBase.Rmd", "/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/PCMBase.Rcheck/vign_test/PCMBase",
     TRUE, FALSE, "PCMBase", "UTF-8", "/tmp/RtmpgOvHcG/file15f245de5bcb.rds")
    
     --- 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: 0xc254770>
    <environment: namespace:PCMBase>
     --- function search by body ---
    Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
    Quitting from lines 314-315 (PCMBase.Rmd)
    Error: processing vignette 'PCMBase.Rmd' failed with diagnostics:
    the condition has length > 1
    --- failed re-building 'PCMBase.Rmd'
    
    --- re-building 'PCMCreateModel.Rmd' using rmarkdown
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    PCMBase
     --- call from context ---
    PCMLik.GaussianPCM(mData, tree.ab, PCMBase_model_BM_drift)
     --- 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(mData, tree.ab, PCMBase_model_BM_drift)
    where 2: PCMLik(mData, tree.ab, PCMBase_model_BM_drift)
    where 3: eval(expr, envir, enclos)
    where 4: eval(expr, envir, enclos)
    where 5: withVisible(eval(expr, envir, enclos))
    where 6: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
     error = eHandler, message = mHandler)
    where 7: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
     enclos)), warning = wHandler, error = eHandler, message = mHandler))
    where 8: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
    where 9: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
     debug = debug, last = i == length(out), use_try = stop_on_error !=
     2L, keep_warning = keep_warning, keep_message = keep_message,
     output_handler = output_handler, include_timing = include_timing)
    where 10: evaluate::evaluate(...)
    where 11: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
     keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
     options$include) 0L else 2L, output_handler = knit_handlers(options$render,
     options))
    where 12: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
     keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
     stop_on_error = if (options$error && options$include) 0L else 2L,
     output_handler = knit_handlers(options$render, options)))
    where 13: block_exec(params)
    where 14: call_block(x)
    where 15: process_group.block(group)
    where 16: process_group(group)
    where 17: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
     error = function(e) {
     setwd(wd)
     cat(res, sep = "\n", file = output %n% "")
     message("Quitting from lines ", paste(current_lines(i),
     collapse = "-"), " (", knit_concord$get("infile"),
     ") ")
     })
    where 18: process_file(text, output)
    where 19: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet,
     encoding = encoding)
    where 20: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
     ...)
    where 21: vweave_rmarkdown(...)
    where 22: engine$weave(file, quiet = quiet, encoding = enc)
    where 23: doTryCatch(return(expr), name, parentenv, handler)
    where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
    where 25: tryCatchList(expr, classes, parentenv, handlers)
    where 26: tryCatch({
     engine$weave(file, quiet = quiet, encoding = enc)
     setwd(startdir)
     output <- find_vignette_product(name, by = "weave", engine = engine)
     if (!have.makefile && vignette_is_tex(output)) {
     texi2pdf(file = output, clean = FALSE, quiet = quiet)
     output <- find_vignette_product(name, by = "texi2pdf",
     engine = engine)
     }
    }, error = function(e) {
     OK <<- FALSE
     message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
     file, conditionMessage(e)))
    })
    where 27: tools:::.buildOneVignette("PCMCreateModel.Rmd", "/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/PCMBase.Rcheck/vign_test/PCMBase",
     TRUE, FALSE, "PCMCreateModel", "UTF-8", "/tmp/RtmpgOvHcG/file15f24235634e.rds")
    
     --- 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: 0x9649ff0>
    <environment: namespace:PCMBase>
     --- function search by body ---
    Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
    Quitting from lines 399-401 (PCMCreateModel.Rmd)
    Error: processing vignette 'PCMCreateModel.Rmd' failed with diagnostics:
    the condition has length > 1
    --- failed re-building 'PCMCreateModel.Rmd'
    
    --- re-building 'PCMParam.Rmd' using rmarkdown
    --- finished re-building 'PCMParam.Rmd'
    
    --- re-building 'PCMTracePruning.Rmd' using rmarkdown
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    PCMBase
     --- call from context ---
    PCMLik.GaussianPCM(X[, tree$tip.label], tree, model.OU.BM)
     --- 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(X[, tree$tip.label], tree, model.OU.BM)
    where 2: PCMLik(X[, tree$tip.label], tree, model.OU.BM)
    where 3: eval(expr, envir, enclos)
    where 4: eval(expr, envir, enclos)
    where 5: withVisible(eval(expr, envir, enclos))
    where 6: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,
     error = eHandler, message = mHandler)
    where 7: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,
     enclos)), warning = wHandler, error = eHandler, message = mHandler))
    where 8: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,
     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
    where 9: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
     debug = debug, last = i == length(out), use_try = stop_on_error !=
     2L, keep_warning = keep_warning, keep_message = keep_message,
     output_handler = output_handler, include_timing = include_timing)
    where 10: evaluate::evaluate(...)
    where 11: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
     keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
     options$include) 0L else 2L, output_handler = knit_handlers(options$render,
     options))
    where 12: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
     keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
     stop_on_error = if (options$error && options$include) 0L else 2L,
     output_handler = knit_handlers(options$render, options)))
    where 13: block_exec(params)
    where 14: call_block(x)
    where 15: process_group.block(group)
    where 16: process_group(group)
    where 17: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
     error = function(e) {
     setwd(wd)
     cat(res, sep = "\n", file = output %n% "")
     message("Quitting from lines ", paste(current_lines(i),
     collapse = "-"), " (", knit_concord$get("infile"),
     ") ")
     })
    where 18: process_file(text, output)
    where 19: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet,
     encoding = encoding)
    where 20: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),
     ...)
    where 21: vweave_rmarkdown(...)
    where 22: engine$weave(file, quiet = quiet, encoding = enc)
    where 23: doTryCatch(return(expr), name, parentenv, handler)
    where 24: tryCatchOne(expr, names, parentenv, handlers[[1L]])
    where 25: tryCatchList(expr, classes, parentenv, handlers)
    where 26: tryCatch({
     engine$weave(file, quiet = quiet, encoding = enc)
     setwd(startdir)
     output <- find_vignette_product(name, by = "weave", engine = engine)
     if (!have.makefile && vignette_is_tex(output)) {
     texi2pdf(file = output, clean = FALSE, quiet = quiet)
     output <- find_vignette_product(name, by = "texi2pdf",
     engine = engine)
     }
    }, error = function(e) {
     OK <<- FALSE
     message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",
     file, conditionMessage(e)))
    })
    where 27: tools:::.buildOneVignette("PCMTracePruning.Rmd", "/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/PCMBase.Rcheck/vign_test/PCMBase",
     TRUE, FALSE, "PCMTracePruning", "UTF-8", "/tmp/RtmpgOvHcG/file15f2549b217f.rds")
    
     --- 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: 0x5f68888>
    <environment: namespace:PCMBase>
     --- function search by body ---
    Function PCMLik.GaussianPCM in namespace PCMBase has this body.
     ----------- END OF FAILURE REPORT --------------
    Quitting from lines 172-195 (PCMTracePruning.Rmd)
    Error: processing vignette 'PCMTracePruning.Rmd' failed with diagnostics:
    the condition has length > 1
    --- failed re-building 'PCMTracePruning.Rmd'
    
    SUMMARY: processing the following files failed:
     'PCMBase.Rmd' 'PCMCreateModel.Rmd' 'PCMTracePruning.Rmd'
    
    Error: Vignette re-building failed.
    Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 1.2.10
Check: package dependencies
Result: NOTE
    Package suggested but not available for checking: ‘ggtree’
Flavor: r-release-osx-x86_64

Version: 1.2.10
Check: re-building of vignette outputs
Result: WARN
    Error(s) in re-building vignettes:
    --- re-building ‘PCMBase.Rmd’ using rmarkdown
    Warning in engine$weave(file, quiet = quiet, encoding = enc) :
     Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to R Markdown v1.
    Failed with error: 'there is no package called 'ggtree''
    trying URL 'https://bioconductor.org/packages/3.9/bioc/bin/macosx/el-capitan/contrib/3.6/treeio_1.8.2.tgz'
    Content type 'application/x-gzip' length 719329 bytes (702 KB)
    ==================================================
    downloaded 702 KB
    
    trying URL 'https://bioconductor.org/packages/3.9/bioc/bin/macosx/el-capitan/contrib/3.6/BiocVersion_3.9.0.tgz'
    Content type 'application/x-gzip' length 5513 bytes
    ==================================================
    downloaded 5513 bytes
    
    trying URL 'https://bioconductor.org/packages/3.9/bioc/bin/macosx/el-capitan/contrib/3.6/ggtree_1.16.6.tgz'
    Content type 'application/x-gzip' length 685419 bytes (669 KB)
    ==================================================
    downloaded 669 KB
    
    Quitting from lines 37-53 (PCMBase.Rmd)
    Error: processing vignette 'PCMBase.Rmd' failed with diagnostics:
    argument is not interpretable as logical
    --- failed re-building ‘PCMBase.Rmd’
    
    --- re-building ‘PCMCreateModel.Rmd’ using rmarkdown
    Warning in engine$weave(file, quiet = quiet, encoding = enc) :
     Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to R Markdown v1.
    --- finished re-building ‘PCMCreateModel.Rmd’
    
    --- re-building ‘PCMParam.Rmd’ using rmarkdown
    Warning in engine$weave(file, quiet = quiet, encoding = enc) :
     Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to R Markdown v1.
    --- finished re-building ‘PCMParam.Rmd’
    
    --- re-building ‘PCMTracePruning.Rmd’ using rmarkdown
    Warning in engine$weave(file, quiet = quiet, encoding = enc) :
     Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to R Markdown v1.
    --- finished re-building ‘PCMTracePruning.Rmd’
    
    SUMMARY: processing the following file failed:
     ‘PCMBase.Rmd’
    
    Error: Vignette re-building failed.
    Execution halted
Flavor: r-release-osx-x86_64

Version: 1.2.10
Check: re-building of vignette outputs
Result: WARN
    Error in re-building vignettes:
     ...
    Warning in engine$weave(file, quiet = quiet, encoding = enc) :
     Pandoc (>= 1.12.3) and/or pandoc-citeproc not available. Falling back to R Markdown v1.
    Failed with error: 'object 'as_data_frame' is not exported by 'namespace:tidytree''
    Quitting from lines 37-53 (PCMBase.Rmd)
    Error: processing vignette 'PCMBase.Rmd' failed with diagnostics:
    argument is not interpretable as logical
    Execution halted
Flavor: r-oldrel-osx-x86_64