Error(s) in re-building vignettes:
  ...
--- re-building 'LBSPR.Rmd' using rmarkdown
Fitting model
Year:
1
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
LBSPR
 --- call from context --- 
LBSPRfit_(yr = X, LB_pars = LB_pars, LB_lengths = LB_lengths, 
    Control = Control, pen = pen, useCPP = useCPP, verbose = verbose)
 --- call from argument --- 
if (class(varcov) == "try-error") class(opt) <- "try-error"
 --- R stacktrace ---
where 1: LBSPRfit_(yr = X, LB_pars = LB_pars, LB_lengths = LB_lengths, 
    Control = Control, pen = pen, useCPP = useCPP, verbose = verbose)
where 2: FUN(X[[i]], ...)
where 3: lapply(X = X, FUN = FUN, ...)
where 4: sapply(cols, function(X) LBSPRfit_(yr = X, LB_pars = LB_pars, 
    LB_lengths = LB_lengths, Control = Control, pen = pen, useCPP = useCPP, 
    verbose = verbose))
where 5: LBSPRfit(MyPars, Len1)
where 6: eval(expr, envir, enclos)
where 7: eval(expr, envir, enclos)
where 8: withVisible(eval(expr, envir, enclos))
where 9: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, 
    error = eHandler, message = mHandler)
where 10: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, 
    enclos)), warning = wHandler, error = eHandler, message = mHandler))
where 11: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, 
    envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
where 12: 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 13: evaluate::evaluate(...)
where 14: 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 15: 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 16: block_exec(params)
where 17: call_block(x)
where 18: process_group.block(group)
where 19: process_group(group)
where 20: 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 21: process_file(text, output)
where 22: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet, 
    encoding = encoding)
where 23: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(), 
    ...)
where 24: vweave_rmarkdown(...)
where 25: engine$weave(file, quiet = quiet, encoding = enc)
where 26: doTryCatch(return(expr), name, parentenv, handler)
where 27: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 28: tryCatchList(expr, classes, parentenv, handlers)
where 29: 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)
    }
    outputs <- c(outputs, output)
}, error = function(e) {
    thisOK <<- FALSE
    fails <<- c(fails, file)
    message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s", 
        file, conditionMessage(e)))
})
where 30: tools:::buildVignettes(dir = "/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/LBSPR.Rcheck/vign_test/LBSPR", 
    ser_elibs = "/tmp/RtmpttwKbh/file57003f0f0808.rds")

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (yr = 1, LB_pars = NULL, LB_lengths = NULL, Control = list(), 
    pen = TRUE, useCPP = TRUE, verbose = TRUE) 
{
    if (verbose) 
        message(yr)
    if (class(LB_pars) != "LB_pars") 
        stop("LB_pars must be of class 'LB_pars'. Use: new('LB_pars')", 
            call. = FALSE)
    if (class(LB_lengths) != "LB_lengths") 
        stop("LB_lengths must be of class 'LB_lengths'. Use: new('LB_lengths')", 
            call. = FALSE)
    if (yr > LB_lengths@NYears) 
        stop("yr greater than LBSPR_obj@NYears", call. = FALSE)
    SingYear <- LB_lengths
    SingYear@LData <- as.matrix(SingYear@LData[, yr])
    SingYear@Years <- LB_lengths@Years[yr]
    SingYear@NYears <- 1
    ldat <- SingYear@LData
    LMids <- SingYear@LMids
    LB_pars@BinWidth <- LMids[2] - LMids[1]
    LB_pars@BinMin <- LMids[1] - 0.5 * LB_pars@BinWidth
    LB_pars@BinMax <- LMids[length(LMids)] + 0.5 * LB_pars@BinWidth
    con <- list(maxsd = 2, modtype = c("GTG", "absel"), ngtg = 13, 
        P = 0.01, Nage = 101, maxFM = 4, method = "BFGS")
    nmsC <- names(con)
    con[(namc <- names(Control))] <- Control
    if (length(noNms <- namc[!namc %in% nmsC])) {
        warning("unknown names in Control: ", paste(noNms, collapse = ", "), 
            call. = FALSE)
        cat("Options are: ", paste(names(con), collapse = ", "), 
            "\n")
    }
    maxsd <- con$maxsd
    if (maxsd < 1) 
        warning("maximum standard deviation is too small. See the help documentation", 
            call. = FALSE)
    modType <- match.arg(arg = con$modtype, choices = c("GTG", 
        "absel"))
    ngtg <- con$ngtg
    sSL50 <- LMids[which.max(ldat)]/LB_pars@Linf
    sDel <- 0.2 * LMids[which.max(ldat)]/LB_pars@Linf
    sFM <- 0.5
    Start <- log(c(sSL50, sDel, sFM))
    if (useCPP) {
        By <- SingYear@LMids[2] - SingYear@LMids[1]
        LMids <- SingYear@LMids
        LBins <- seq(from = LMids[1] - 0.5 * By, by = By, length.out = length(SingYear@LMids) + 
            1)
        LDat <- SingYear@LData
        if (LBins[1] != 0 & (LBins[1] - By) > 0) {
            fstBins <- seq(from = 0, by = By, to = LBins[1] - 
                By)
            fstMids <- seq(from = 0.5 * By, by = By, to = LMids[1] - 
                By)
            ZeroDat <- rep(0, length(fstMids))
            LMids <- c(fstMids, LMids)
            LBins <- c(fstBins, LBins)
            LDat <- c(ZeroDat, LDat)
        }
        if (modType == "GTG") {
            SDLinf <- LB_pars@CVLinf * LB_pars@Linf
            gtgLinfs <- seq(from = LB_pars@Linf - maxsd * SDLinf, 
                to = LB_pars@Linf + maxsd * SDLinf, length = ngtg)
            MKL <- LB_pars@MK * (LB_pars@Linf/(LBins + 0.5 * 
                By))^ifelse(is.null(LB_pars@Mpow) || length(LB_pars@Mpow) < 
                1, 0, LB_pars@Mpow[1])
            MKMat <- matrix(rep(MKL, ngtg), nrow = length(LBins), 
                ncol = ngtg)
            recP <- dnorm(gtgLinfs, LB_pars@Linf, sd = SDLinf)/sum(dnorm(gtgLinfs, 
                LB_pars@Linf, sd = SDLinf))
            usePen <- 1
            if (!pen) 
                usePen <- 0
            opt <- try(optim(Start, LBSPR_NLLgtg, LMids = LMids, 
                LBins = LBins, LDat = LDat, gtgLinfs = gtgLinfs, 
                MKMat = MKMat, MK = LB_pars@MK, Linf = LB_pars@Linf, 
                ngtg = ngtg, recP = recP, usePen = usePen, hessian = TRUE, 
                method = Control$method), silent = TRUE)
            varcov <- try(solve(opt$hessian), silent = TRUE)
            if (class(varcov) == "try-error") 
                class(opt) <- "try-error"
            if (class(varcov) != "try-error" && any(diag(varcov) < 
                0)) 
                class(opt) <- "try-error"
            count <- 0
            countmax <- 10
            quants <- seq(from = 0, to = 0.95, length.out = countmax)
            while (class(opt) == "try-error" & count < countmax) {
                count <- count + 1
                sSL50 <- quantile(c(LMids[min(which(ldat > 0))]/LB_pars@Linf, 
                  LMids[which.max(ldat)]/LB_pars@Linf), probs = quants)[count]
                sSL50 <- as.numeric(sSL50)
                Start <- log(c(sSL50, sDel, sFM))
                opt <- try(optim(Start, LBSPR_NLLgtg, LMids = LMids, 
                  LBins = LBins, LDat = LDat, gtgLinfs = gtgLinfs, 
                  MKMat = MKMat, MK = LB_pars@MK, Linf = LB_pars@Linf, 
                  ngtg = ngtg, recP = recP, usePen = usePen, 
                  hessian = TRUE, method = Control$method), silent = TRUE)
                varcov <- try(solve(opt$hessian), silent = TRUE)
                if (class(varcov) == "try-error") 
                  class(opt) <- "try-error"
                if (class(varcov) != "try-error" && any(diag(varcov) < 
                  0)) 
                  class(opt) <- "try-error"
            }
            if (class(opt) == "try-error") {
                opt <- try(optim(Start, LBSPR_NLLgtg, LMids = LMids, 
                  LBins = LBins, LDat = LDat, gtgLinfs = gtgLinfs, 
                  MKMat = MKMat, MK = LB_pars@MK, Linf = LB_pars@Linf, 
                  ngtg = ngtg, recP = recP, usePen = usePen, 
                  hessian = FALSE, method = Control$method))
                varcov <- matrix(NA, 3, 3)
            }
            NLL <- opt$value
        }
        else {
            usePen <- 1
            if (!pen) 
                usePen <- 0
            P <- con$P
            Nage <- con$Nage
            x <- seq(from = 0, to = 1, length.out = Nage)
            opt <- try(optim(Start, LBSPR_NLLabsel, x = x, P = P, 
                LMids = LMids, LBins = LBins, LDat = LDat, MK = LB_pars@MK, 
                Linf = LB_pars@Linf, FecB = LB_pars@FecB, L50 = LB_pars@L50, 
                L95 = LB_pars@L95, maxsd = maxsd, CVLinf = LB_pars@CVLinf, 
                Nage = Nage, usePen = TRUE, hessian = TRUE, method = Control$method), 
                silent = TRUE)
            varcov <- try(solve(opt$hessian), silent = TRUE)
            if (class(varcov) == "try-error") 
                class(opt) <- "try-error"
            if (class(varcov) != "try-error" && any(diag(varcov) < 
                0)) 
                class(opt) <- "try-error"
            count <- 0
            countmax <- 10
            quants <- seq(from = 0, to = 0.95, length.out = countmax)
            while (class(opt) == "try-error" & count < countmax) {
                count <- count + 1
                sSL50 <- quantile(c(LMids[min(which(ldat > 0))]/LB_pars@Linf, 
                  LMids[which.max(ldat)]/LB_pars@Linf), probs = quants)[count]
                sSL50 <- as.numeric(sSL50)
                Start <- log(c(sSL50, sDel, sFM))
                opt <- try(optim(Start, LBSPR_NLLabsel, x = x, 
                  P = P, LMids = LMids, LBins = LBins, LDat = LDat, 
                  MK = LB_pars@MK, Linf = LB_pars@Linf, FecB = LB_pars@FecB, 
                  L50 = LB_pars@L50, L95 = LB_pars@L95, maxsd = maxsd, 
                  CVLinf = LB_pars@CVLinf, Nage = Nage, usePen = TRUE, 
                  hessian = TRUE, method = Control$method), silent = TRUE)
                varcov <- try(solve(opt$hessian), silent = TRUE)
                if (class(varcov) == "try-error") 
                  class(opt) <- "try-error"
                if (class(varcov) != "try-error" && any(diag(varcov) < 
                  0)) 
                  class(opt) <- "try-error"
            }
            if (class(opt) == "try-error") {
                opt <- try(optim(Start, LBSPR_NLLabsel, x = x, 
                  P = P, LMids = LMids, LBins = LBins, LDat = LDat, 
                  MK = LB_pars@MK, Linf = LB_pars@Linf, FecB = LB_pars@FecB, 
                  L50 = LB_pars@L50, L95 = LB_pars@L95, maxsd = maxsd, 
                  CVLinf = LB_pars@CVLinf, Nage = Nage, usePen = TRUE, 
                  hessian = FALSE, method = Control$method), 
                  silent = TRUE)
                varcov <- matrix(NA, 3, 3)
            }
            NLL <- opt$value
        }
    }
    else {
        opt <- optim(Start, LBSPRopt, LB_pars = LB_pars, LB_lengths = SingYear, 
            Control = Control, pen = pen, hessian = TRUE, method = Control$method)
        varcov <- solve(opt$hessian)
        NLL <- opt$value
    }
    LB_pars@SL50 <- exp(opt$par)[1] * LB_pars@Linf
    LB_pars@SL95 <- LB_pars@SL50 + (exp(opt$par)[2] * LB_pars@Linf)
    LB_pars@FM <- exp(opt$par)[3]
    MLEs <- opt$par
    vSL50 <- (exp(opt$par[1]) * LB_pars@Linf)^2 * varcov[1, 1]
    vSL95 <- (LB_pars@Linf * exp(MLEs[2]))^2 * varcov[2, 2] + 
        (LB_pars@Linf * exp(MLEs[1]))^2 * varcov[1, 1] + LB_pars@Linf * 
        exp(MLEs[2]) * LB_pars@Linf * exp(MLEs[1]) * varcov[1, 
        2]
    vFM <- exp(opt$par[3])^2 * varcov[3, 3]
    vSPR <- varSPR(opt$par, varcov, LB_pars)
    elog <- 0
    if (all(is.na(varcov)) | any(diag(varcov) < 0)) {
        warning("The final Hessian is not positive definite. Estimates may be unreliable", 
            call. = FALSE)
        flush.console()
        elog <- 1
    }
    if (LB_pars@SL50/LB_pars@Linf > 0.85) 
        elog <- 2
    if (LB_pars@FM > 5) 
        elog <- 3
    if (LB_pars@SL50/LB_pars@Linf > 0.85 & LB_pars@FM > 5) 
        elog <- 4
    runMod <- LBSPRsim_(LB_pars, Control = Control, verbose = FALSE, 
        doCheck = FALSE)
    LBobj <- new("LB_obj")
    Slots <- slotNames(LB_pars)
    for (X in 1:length(Slots)) slot(LBobj, Slots[X]) <- slot(LB_pars, 
        Slots[X])
    Slots <- slotNames(SingYear)
    for (X in 1:length(Slots)) slot(LBobj, Slots[X]) <- slot(SingYear, 
        Slots[X])
    LBobj@Vars <- matrix(c(vSL50, vSL95, vFM, vSPR), ncol = 4)
    LBobj@pLCatch <- runMod@pLCatch
    LBobj@NLL <- NLL
    LBobj@SPR <- runMod@SPR
    LBobj@Yield <- runMod@Yield
    LBobj@YPR <- runMod@YPR
    LBobj@maxFM <- runMod@maxFM
    LBobj@fitLog <- elog
    LBobj
}
<bytecode: 0x9f19748>
<environment: namespace:LBSPR>
 --- function search by body ---
Function LBSPRfit_ in namespace LBSPR has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1