Running examples in ‘mixmeta-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: bcg
> ### Title: Efficacy of BCG Vaccine in the Prevention of Tuberculosis
> ### Aliases: bcg
> ### Keywords: datasets
> 
> ### ** Examples
> 
> ### REPRODUCE THE RESULTS IN VAN HOUWELINGEN ET AL (2002)
> 
> # FIXED-EFFECTS META-ANALYSIS (SECTION 3.1.1)
> unifix <- mixmeta(logor, logorvar, data=bcg, method="fixed")
> print(summary(unifix), digits=3)
Call:  mixmeta(formula = logor, S = logorvar, data = bcg, method = "fixed")

Univariate fixed-effects meta-analysis
Dimension: 1

Fixed-effects coefficients
             Estimate  Std. Error        z  Pr(>|z|)  95%ci.lb  95%ci.ub     
(Intercept)    -0.436       0.042  -10.319     0.000    -0.519    -0.353  ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Univariate Cochran Q-test for heterogeneity:
Q = 163.165 (df = 12), p-value = 0.000
I-square statistic = 92.6%

13 units, 1 outcome, 13 observations, 1 fixed and 0 random-effects parameters
 logLik      AIC      BIC  
-76.029  154.058  154.623  

> 
> # RANDOM-EFFECTS META-ANALYSIS WITH MAXIMUM LIKELIHOOD (SECTION 3.1.2)
> uniran <- mixmeta(logor, logorvar, data=bcg, method="ml")
> print(summary(uniran), digits=3, report="var")
Call:  mixmeta(formula = logor, S = logorvar, data = bcg, method = "ml")

Univariate random-effects meta-analysis
Dimension: 1
Estimation method: ML

Fixed-effects coefficients
             Estimate  Std. Error       z  Pr(>|z|)  95%ci.lb  95%ci.ub     
(Intercept)    -0.742       0.178  -4.169     0.000    -1.091    -0.393  ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Random-effects (co)variance components
 Structure: General positive-definite
    Var
  0.302

Univariate Cochran Q-test for heterogeneity:
Q = 163.165 (df = 12), p-value = 0.000
I-square statistic = 92.6%

13 units, 1 outcome, 13 observations, 1 fixed and 1 random-effects parameters
 logLik      AIC      BIC  
-13.073   30.146   31.275  

> 
> # ORIGINAL ESTIMATES AND BEST-LINEAR UNBIASED PREDICTIONS (FIGURE 3)
> pred <- with(bcg, cbind(logor, logor-1.96*sqrt(logorvar),
+   logor+1.96*sqrt(logorvar)))
> blup <- blup(uniran, pi=TRUE)
> plot(pred[,1], rev(bcg$trial)+0.2, xlim=c(-3,3), ylim=c(0,14), pch=18,
+   axes=FALSE, xlab="Log odds ratio", ylab="Trial", main="Forest plot")
> axis(1)
> axis(2, at=bcg$trial, labels=rev(bcg$trial), lty=0, las=1)
> abline(v=coef(uniran))
> segments(pred[,2], rev(bcg$trial)+0.2, pred[,3], rev(bcg$trial)+0.2, lty=5)
> points(blup[,1], rev(bcg$trial)-0.2, pch=19)
> segments(blup[,2], rev(bcg$trial)-0.2, blup[,3], rev(bcg$trial)-0.2)
> 
> # COMPUTE THE OUTCOME SEPARATELY FOR TREATMENT AND CONTROL GROUPS
> y <- with(bcg, log(cbind(tpos/tneg, cpos/cneg)))
> S <- with(bcg, cbind(1/tpos+1/tneg, 1/cpos+1/cneg))
> 
> # BIVARIATE RANDOM-EFFECTS META-ANALYSIS (SECTION 4)
> mvran <- mixmeta(y, S, method="ml")
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
mixmeta
 --- call from context --- 
mixmeta(y, S, method = "ml")
 --- call from argument --- 
if (class(eval(substitute(formula), data)) != "formula") {
    formula <- as.formula(paste(deparse(substitute(formula), 
        width.cutoff = 499L), "~ 1"), env = parent.frame())
} else if (length(formula) != 3) stop("'formula' must be a two-sided formula")
 --- R stacktrace ---
where 1: mixmeta(y, S, method = "ml")

 --- value of length: 2 type: logical ---
[1] TRUE TRUE
 --- function from context --- 
function (formula, S, data, random, method = "reml", bscov = "unstr", 
    offset, subset, contrasts = NULL, na.action, model = TRUE, 
    control = list()) 
{
    if (missing(data)) 
        data <- parent.frame()
    if (class(eval(substitute(formula), data)) != "formula") {
        formula <- as.formula(paste(deparse(substitute(formula), 
            width.cutoff = 499L), "~ 1"), env = parent.frame())
    }
    else if (length(formula) != 3) 
        stop("'formula' must be a two-sided formula")
    method <- match.arg(method, c("fixed", "ml", "reml", "mm", 
        "vc", "model.frame"))
    control <- do.call("mixmeta.control", control)
    random <- getRandom(random, method, env = environment(formula))
    bscov <- getBSCov(bscov, random, method)
    call <- match.call()
    mcall <- match.call(expand.dots = FALSE)
    mn <- match(c("formula", "data", "subset", "na.action", "offset"), 
        names(mcall), 0L)
    mcall <- mcall[c(1L, mn)]
    mcall$drop.unused.levels <- TRUE
    mcall[[1L]] <- as.name("model.frame")
    mcall$formula <- getFullFormula(formula, random)
    mcall$na.action <- "na.pass"
    mf <- eval(mcall, parent.frame())
    class(mf) <- c("data.frame.mixmeta", class(mf))
    if (missing(na.action)) 
        na.action <- getOption("na.action")
    if (length(na.action)) 
        mf <- do.call(na.action, list(mf))
    if (method == "model.frame") 
        return(mf)
    terms <- getFixTerms(formula, attr(mf, "terms"))
    groups <- getGroups(random, mf)
    ord <- do.call(order, lapply(seq(ncol(groups)), function(i) groups[, 
        i]))
    groups <- groups[ord, , drop = FALSE]
    mf <- mf[ord, , drop = FALSE]
    y <- as.matrix(model.response(mf, "numeric"))
    fixcontr <- getContrXlev(formula[c(1L, 3L)], contrasts)
    X <- model.matrix(formula[c(1L, 3L)], mf, fixcontr)
    offset <- as.vector(model.offset(mf))
    if (!is.null(offset)) {
        if (length(offset) != NROW(y)) 
            stop("number of offsets should equal number of observations")
        y <- y - offset
    }
    Z <- getZ(random, mf, contrasts)
    S <- eval(call$S, data, parent.frame())
    S <- getS(S, y, attr(mf, "na.action"), if (missing(subset)) 
        NULL
    else eval(call$subset, data, parent.frame()), ord, control$Scor, 
        control$checkPD)
    fit <- mixmeta.fit(X, Z, y, S, groups, method, bscov, control)
    if (!is.null(offset)) 
        fit$fitted.values <- fit$fitted.values + offset
    fit$fitted.values <- fit$fitted.values[order(ord), ]
    fit$residuals <- fit$residuals[order(ord), ]
    fit$offset <- offset[order(ord)]
    fit$S <- S[order(ord), ]
    fit$call <- call
    fit$formula <- formula
    fit$model <- if (model) 
        mf <- mf[order(ord), , drop = FALSE]
    else NULL
    fit$terms <- terms
    contrasts <- do.call(c, lapply(c(getList(X), getList(Z)), 
        attr, "contrasts"))
    fit$contrasts <- if (length(contrasts)) 
        contrasts[!duplicated(names(contrasts))]
    else NULL
    fit$xlevels <- .getXlevels(attr(mf, "terms"), mf)
    fit$na.action <- attr(mf, "na.action")
    fit$method <- method
    fit$random <- random
    fit$bscov <- bscov
    fit$control <- control
    class(fit) <- "mixmeta"
    fit
}
<bytecode: 0x55dd9cf03b68>
<environment: namespace:mixmeta>
 --- function search by body ---
Function mixmeta in namespace mixmeta has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1