Running examples in 'CalibrateSSB-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: CalSSBobj
> ### Title: Create or modify a CalSSB object
> ### Aliases: CalSSBobj
> 
> ### ** Examples
> 
> #' # Generates data - two years
> z <- AkuData(3000)  # 3000 in each quarter
> zPop <- AkuData(10000)[, 1:7]
> 
> # Create a CalSSB object by CalibrateSSB
> b <- CalibrateSSB(z, calmodel = "~ sex*age", partition = c("year", "q"), popData = zPop, 
+                   y = c("unemployed", "workforce"))
> 
> # Modify the CalSSB object
> a <- CalSSBobj(b, w = 10*b$w, wave = CrossStrata(z[, c("year", "q")]), id = z$id)
> 
> # Use the CalSSB object as input ...
> PanelEstimation(WideFromCalibrate(a), "unemployed", linComb = PeriodDiff(8, 4))
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
CalibrateSSB
 --- call from context --- 
PanelEstimation(WideFromCalibrate(a), "unemployed", linComb = PeriodDiff(8, 
    4))
 --- call from argument --- 
if (class(x$w) == "NULL") {
    z = vector("list", length(x))
    names(z) = names(x)
    n = dim(ListCbind(x[[1]]$y, numerator))[2]
    for (i in 1:length(x)) z[[i]] = PanelEstimation(x[[i]], numerator, 
        denominator, linComb, linComb0, estType, leveragePower, 
        group, returnCov, usewGross)
    return(z)
}
 --- R stacktrace ---
where 1: PanelEstimation(WideFromCalibrate(a), "unemployed", linComb = PeriodDiff(8, 
    4))

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (x, numerator, denominator = NULL, linComb = matrix(0, 
    0, n), linComb0 = NULL, estType = "robustModel", leveragePower = 1/2, 
    group = NULL, returnCov = FALSE, usewGross = TRUE) 
{
    if (class(x$w) == "NULL") {
        z = vector("list", length(x))
        names(z) = names(x)
        n = dim(ListCbind(x[[1]]$y, numerator))[2]
        for (i in 1:length(x)) z[[i]] = PanelEstimation(x[[i]], 
            numerator, denominator, linComb, linComb0, estType, 
            leveragePower, group, returnCov, usewGross)
        return(z)
    }
    if (is.null(denominator)) {
        m = length(numerator)
        y = ListCbind(x$y, numerator)
        n = dim(y)[2]
        nlc = dim(linComb)[1]
        w = RepCbind(x$w, m)
        if (usewGross & !is.null(x$wGross)) {
            samplingWeights = RepCbind(x$wGross, m)
        }
        else {
            if (!is.null(x$samplingWeights)) 
                samplingWeights = RepCbind(x$samplingWeights, 
                  m)
            else samplingWeights = NULL
        }
        if (!is.null(x$leverages)) 
            leverages = RepCbind(x$leverages, m)
        else leverages = 0
        if (!is.null(x$leverages2)) 
            leverages2 = RepCbind(x$leverages2, m)
        else leverages2 = 0
        resids = ListCbind(x$resids, numerator)/(1 - leverages)^leveragePower
        if (!is.null(x$resids2)) 
            resids2 = ListCbind(x$resids2, numerator)/(1 - leverages2)^leveragePower
        else resids2 = NULL
    }
    else {
        n = dim(x$y[[numerator]])[2]
        nlc = dim(linComb)[1]
        y = cbind(x$y[[numerator]], x$y[[denominator]])
        w = cbind(x$w, x$w)
        if (usewGross & !is.null(x$wGross)) {
            samplingWeights = cbind(x$wGross, x$wGross)
        }
        else {
            if (!is.null(x$samplingWeights)) 
                samplingWeights = cbind(x$samplingWeights, x$samplingWeights)
            else samplingWeights = NULL
        }
        if (!is.null(x$leverages)) 
            leverages = cbind(x$leverages, x$leverages)
        else leverages = 0
        if (!is.null(x$leverages2)) 
            leverages2 = cbind(x$leverages2, x$leverages2)
        else leverages2 = 0
        resids = cbind(x$resids[[numerator]], x$resids[[denominator]])/(1 - 
            leverages)^leveragePower
        if (!is.null(x$resids2)) 
            resids2 = cbind(x$resids2[[numerator]], x$resids2[[denominator]])/(1 - 
                leverages2)^leveragePower
        else resids2 = NULL
    }
    if (!is.null(group)) {
        gr = group
        group = rowNoNA(data.matrix(x$extra[[gr]]))
        group2 = rowNoNA(data.matrix(x$extra[[gr]]), max)
        eq = sum(as.numeric(!(group == group2), na.rm = TRUE))
        if (eq > 0) 
            warning(sprintf("Non-unique group detected. Last not equal first in %d cases. First used.", 
                eq))
    }
    covTotals = TotalsWithCov(y, resids, w, estType, resids2, 
        samplingWeights = samplingWeights, group = group)
    a = NULL
    a$wTot = colSums(x$w, na.rm = TRUE)
    if (!is.null(samplingWeights)) 
        a$samplingWeightsTot = colSums(samplingWeights, na.rm = TRUE)
    if (is.null(denominator)) {
        if (is.null(linComb0)) 
            A = linComb
        else A = linComb %*% linComb0
        pEst = PanelEst(covTotals$totals, covTotals$covTotals, 
            A = A, returnCov = returnCov)
        a$estimates = pEst$totals[, 1, drop = TRUE]
        if (nlc) 
            a$linCombs = pEst$Atotals[, 1, drop = TRUE]
        a$varEstimates = pEst$varTotals
        if (nlc) 
            a$varLinCombs = pEst$varAtotals
        return(a)
    }
    nn = n
    diag2n = diag(1, 2 * n)
    rownames(diag2n) = colnames(y)
    if (is.null(linComb0)) {
        A = rbind(diag2n, cbind(linComb, matrix(0, dim(linComb)[1], 
            n)), cbind(matrix(0, dim(linComb)[1], n), linComb))
        numerator = 1:n
        names(numerator) = colnames(y)[1:n]
    }
    else {
        A2 = rbind(cbind(linComb0, matrix(0, dim(linComb0)[1], 
            n)), cbind(matrix(0, dim(linComb0)[1], n), linComb0))
        linComb2 = linComb %*% linComb0
        AlinComb2 = rbind(cbind(linComb2, matrix(0, dim(linComb2)[1], 
            n)), cbind(matrix(0, dim(linComb2)[1], n), linComb2))
        A = rbind(A2, AlinComb2)
        n = dim(linComb0)[1]
        nlc = dim(linComb2)[1]
        numerator = 1:n
        names(numerator) = rownames(linComb0)
    }
    pEst = PanelEst(covTotals$totals, covTotals$covTotals, A = A, 
        numerator = numerator, denominator = (n + 1):(2 * n), 
        B = linComb, returnCov = returnCov)
    a$estimates = pEst$ratios[, 1, drop = TRUE]
    a$estimatesNum = pEst$totals[1:nn, 1, drop = TRUE]
    a$estimatesDen = pEst$totals[(nn + 1):(2 * nn), 1, drop = TRUE]
    if (nlc) 
        a$linCombs = pEst$Bratios[, 1, drop = TRUE]
    if (nlc) 
        a$linCombsNum = pEst$Atotals[(2 * n + 1):(2 * n + nlc), 
            1, drop = TRUE]
    if (nlc) 
        a$linCombsDen = pEst$Atotals[(2 * n + nlc + 1):(2 * n + 
            2 * nlc), 1, drop = TRUE]
    a$varEstimates = pEst$varRatios
    a$varEstimatesNum = TakeIndexBoth(pEst$varTotals, 1:nn)
    a$varEstimatesDen = TakeIndexBoth(pEst$varTotals, (nn + 1):(2 * 
        nn))
    if (nlc) 
        a$varLinCombs = pEst$varBratios
    if (nlc) 
        a$varLinCombsNum = TakeIndexBoth(pEst$varAtotals, (2 * 
            n + 1):(2 * n + nlc))
    if (nlc) 
        a$varLinCombsDen = TakeIndexBoth(pEst$varAtotals, (2 * 
            n + nlc + 1):(2 * n + 2 * nlc))
    a
}
<bytecode: 0xa9ba350>
<environment: namespace:CalibrateSSB>
 --- function search by body ---
Function PanelEstimation in namespace CalibrateSSB has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1