Error(s) in re-building vignettes:
--- re-building ‘IPMpack_Vignette.Rnw’ using Sweave
Loading required package: Matrix
Loading required package: MASS
Loading required package: nlme
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
IPMpack
 --- call from context --- 
makeDiscreteTrans(dff)
 --- call from argument --- 
if (class(discreteTrans) != "matrix") stop("Error - the discreteTrans you entered should be a matrix")
 --- R stacktrace ---
where 1: makeDiscreteTrans(dff)
where 2: eval(expr, .GlobalEnv)
where 3: eval(expr, .GlobalEnv)
where 4: withVisible(eval(expr, .GlobalEnv))
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, classes, parentenv, handlers)
where 8: tryCatch(expr, error = function(e) {
    call <- conditionCall(e)
    if (!is.null(call)) {
        if (identical(call[[1L]], quote(doTryCatch))) 
            call <- sys.call(-4L)
        dcall <- deparse(call)[1L]
        prefix <- paste("Error in", dcall, ": ")
        LONG <- 75L
        sm <- strsplit(conditionMessage(e), "\n")[[1L]]
        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
        if (is.na(w)) 
            w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], 
                type = "b")
        if (w > LONG) 
            prefix <- paste0(prefix, "\n  ")
    }
    else prefix <- "Error : "
    msg <- paste0(prefix, conditionMessage(e), "\n")
    .Internal(seterrmessage(msg[1L]))
    if (!silent && isTRUE(getOption("show.error.messages"))) {
        cat(msg, file = outFile)
        .Internal(printDeferredWarnings())
    }
    invisible(structure(msg, class = "try-error", condition = e))
})
where 9: try(withVisible(eval(expr, .GlobalEnv)), silent = TRUE)
where 10: evalFunc(ce, options)
where 11: tryCatchList(expr, classes, parentenv, handlers)
where 12: tryCatch(evalFunc(ce, options), finally = {
    cat("\n")
    sink()
})
where 13: driver$runcode(drobj, chunk, chunkopts)
where 14: utils::Sweave(...)
where 15: engine$weave(file, quiet = quiet, encoding = enc)
where 16: doTryCatch(return(expr), name, parentenv, handler)
where 17: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 18: tryCatchList(expr, classes, parentenv, handlers)
where 19: 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 20: tools:::buildVignettes(dir = "/data/gannet/ripley/R/packages/tests-devel/IPMpack.Rcheck/vign_test/IPMpack", 
    ser_elibs = "/tmp/RtmphJDHJI/file1c5b4a69dec6.rds")

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (dataf, stages = NA, discreteTrans = NA, meanToCont = NA, 
    sdToCont = NA, continuousToDiscreteExplanatoryVariables = "size") 
{
    if (is.na(stages[1])) {
        stages <- names(tapply(c(levels(dataf$stage), levels(dataf$stageNext)), 
            c(levels(dataf$stage), levels(dataf$stageNext)), 
            length))
        if (!is.na(discreteTrans[1])) 
            stages <- c(stages, dimnames(discreteTrans)[[2]])
    }
    stages <- unique(stages)
    stages <- c(stages[!stages %in% c("continuous", "dead")], 
        "continuous", "dead")
    if (length(stages) == 2) 
        stop("Error - no discrete stages found. If no discrete stages are included in your data file, please specify them in the discreteTrans argument of the makeDiscreteTrans function.")
    if (("number" %in% names(dataf)) == FALSE) 
        dataf$number <- 1
    nDiscreteClasses <- length(stages) - 2
    if (is.na(discreteTrans[1]) & length(discreteTrans) == 1) {
        discreteTrans <- matrix(0, nrow = nDiscreteClasses + 
            2, ncol = nDiscreteClasses + 1, dimnames = list(stages, 
            stages[1:(length(stages) - 1)]))
        for (j in stages[1:(length(stages) - 1)]) {
            for (i in stages) discreteTrans[i, j] <- sum(dataf[dataf$stage == 
                j & dataf$stageNext == i, ]$number, na.rm = TRUE)
        }
    }
    if (class(discreteTrans) != "matrix") 
        stop("Error - the discreteTrans you entered should be a matrix")
    if (nrow(discreteTrans) != length(stages) | ncol(discreteTrans) != 
        (length(stages) - 1)) 
        stop("Error - the discreteTrans matrix you entered should be a square matrix with dimensions equal to the number of stages (including continuous)")
    if (sum(dimnames(discreteTrans)[[1]] == stages) < length(stages)) 
        stop("Error - the row names of your discreteTrans matrix should be in alphabetical order, with continuous being the last one")
    if (sum(dimnames(discreteTrans)[[2]] == stages[1:(length(stages) - 
        1)]) < (length(stages) - 1)) 
        stop("Error - the column names of your discreteTrans matrix should be in alphabetical order, with continuous being the last one")
    for (j in stages[1:(length(stages) - 1)]) discreteTrans[, 
        j] <- discreteTrans[, j]/sum(discreteTrans[, j], na.rm = TRUE)
    if (is.na(meanToCont[1]) & length(meanToCont) == 1) {
        meanToCont <- matrix(NA, nrow = 1, ncol = nDiscreteClasses, 
            dimnames = list(1, stages[1:nDiscreteClasses]))
        for (j in stages[which(as.numeric(discreteTrans["continuous", 
            1:nDiscreteClasses]) > 0)]) {
            meanToCont[, j] <- mean(dataf[dataf$stage == j & 
                dataf$stageNext == "continuous", ]$sizeNext, 
                na.rm = TRUE)
        }
    }
    if (class(meanToCont) != "matrix") 
        stop("Error - the meanToCont matrix you entered should be a matrix")
    if (nrow(meanToCont) != 1) 
        stop("Error - the meanToCont matrix you entered should contain just 1 row with means (or NA's for those discrete stages from which no individuals move to the continuous class")
    if (sum(dimnames(meanToCont)[[2]] == stages[1:nDiscreteClasses]) < 
        nDiscreteClasses) 
        stop("Error - the column names of the meanToCont matrix you entered should be in alphabetical order and match the column names of the discrete classes in discreteTrans (so without continuous). If some of the discete stages are not mentioned in your data file, this error can be fixed by adding those stages first: levels(dataf$stage)<-c(levels(dataf$stage),<unmentioned_discrete_stages>)")
    if (is.na(sdToCont[1]) & length(sdToCont) == 1) {
        sdToCont <- matrix(NA, nrow = 1, ncol = nDiscreteClasses, 
            dimnames = list(1, stages[1:nDiscreteClasses]))
        for (j in stages[which(as.numeric(discreteTrans["continuous", 
            1:nDiscreteClasses]) > 0)]) {
            sdToCont[, j] <- sd(dataf[dataf$stage == j & dataf$stageNext == 
                "continuous", ]$sizeNext, na.rm = TRUE)
        }
    }
    if (class(sdToCont) != "matrix") 
        stop("Error - the sdToCont matrix you entered should be a matrix")
    if (nrow(sdToCont) != 1) 
        stop("Error - the sdToCont matrix you entered should contain just 1 row with means (or NA's for those discrete stages from which no individuals move to the continuous class")
    if (sum(dimnames(sdToCont)[[2]] == stages[1:nDiscreteClasses]) < 
        nDiscreteClasses) 
        stop("Error - the column names of the sdToCont matrix you entered should be in alphabetical order and match the column names of the discrete classes in discreteTrans (so without continuous). If some of the discete stages are not mentioned in your data file, this error can be fixed by adding those stages first: levels(dataf$stage)<-c(levels(dataf$stage),<unmentioned_discrete_stages>)")
    if (sum(discreteTrans[stages[1:nDiscreteClasses], "continuous"]) == 
        0) {
        moveToDiscrete <- glm(rep(0, 21) ~ 1, family = binomial)
    }
    else {
        subData <- subset(dataf, dataf$stage == "continuous" & 
            dataf$surv == 1)
        subData$contToDiscrete <- 1
        subData$contToDiscrete[subData$stageNext == "continuous"] <- 0
        subData$size2 <- subData$size^2
        subData$size3 <- subData$size^3
        if (length(grep("expsize", as.character(continuousToDiscreteExplanatoryVariables))) > 
            0) 
            subData$expsize <- exp(subData$size)
        if (length(grep("logsize", as.character(continuousToDiscreteExplanatoryVariables))) > 
            0) 
            subData$logsize <- log(subData$size)
        moveToDiscrete <- glm(paste("contToDiscrete~", continuousToDiscreteExplanatoryVariables, 
            sep = ""), family = binomial, data = subData)
    }
    disTrans <- new("discreteTrans")
    disTrans@discreteTrans <- discreteTrans
    disTrans@meanToCont <- meanToCont
    disTrans@sdToCont <- sdToCont
    disTrans@moveToDiscrete <- moveToDiscrete
    return(disTrans)
}
<bytecode: 0x583fbe0>
<environment: namespace:IPMpack>
 --- function search by body ---
Function makeDiscreteTrans in namespace IPMpack has this body.
 ----------- END OF FAILURE REPORT -------------- 

Error: processing vignette 'IPMpack_Vignette.Rnw' failed with diagnostics:
 chunk 30 
Error in if (class(discreteTrans) != "matrix") stop("Error - the discreteTrans you entered should be a matrix") : 
  the condition has length > 1

--- failed re-building ‘IPMpack_Vignette.Rnw’

SUMMARY: processing the following file failed:
  ‘IPMpack_Vignette.Rnw’

Error: Vignette re-building failed.
Execution halted