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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: dic.fit
> ### Title: censored survival data
> ### Aliases: dic.fit
> 
> ### ** Examples
> 
> data(fluA.inc.per)
> dic.fit(fluA.inc.per, dist="L")
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
coarseDataTools
 --- call from context --- 
dic.fit(fluA.inc.per, dist = "L")
 --- call from argument --- 
if (class(dat) == "data.frame") stop("dat should be a matrix.")
 --- R stacktrace ---
where 1: dic.fit(fluA.inc.per, dist = "L")

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (dat, start.par2 = log(2), opt.method = "L-BFGS-B", 
    par1.int = c(log(0.5), log(13)), par2.int = c(log(1.01), 
        log(log(5))), ptiles = c(0.05, 0.95, 0.99), dist = "L", 
    n.boots = 0, ...) 
{
    check.data.structure(dat)
    if (!dist %in% c("G", "W", "L")) 
        stop("Please use one of the following distributions Log-Normal (L) , Weibull (W), or Gamma (G)")
    if (dist %in% c("G") & n.boots <= 0) 
        stop("You must use bootstraping with this distrbution at the moment.  Please increase n.boots to something larger than 0")
    if (any(ptiles >= 1) | any(ptiles <= 0)) 
        stop("Sorry the percentiles you are requesting are not valid.")
    n <- nrow(dat)
    dat <- as.matrix(dat[, c("EL", "ER", "SL", "SR", "type")])
    if (class(dat) == "data.frame") 
        stop("dat should be a matrix.")
    start.par1 <- optimize(f = pl.par1, interval = par1.int, 
        par2 = start.par2, dat = dat, dist = dist)$min
    start.par2 <- optimize(f = pl.par2, interval = par2.int, 
        par1 = start.par1, dat = dat, dist = dist)$min
    tmp <- list(convergence = 1)
    msg <- NULL
    fail <- FALSE
    tmp <- optim(par = c(start.par1, start.par2), method = opt.method, 
        hessian = TRUE, fn = loglikhd, dat = dat, dist = dist, 
        ...)
    if (tmp$convergence != 0 || all(tmp$hessian == 0)) {
        msg <- tmp$message
        if (all(tmp$hessian == 0)) 
            msg <- paste(msg, "& hessian is singular")
        fail <- TRUE
    }
    if (!fail) {
        untransformed.fit.params <- dist.optim.untransform(dist, 
            tmp$par)
        ptiles.appended <- sort(union(0.5, ptiles))
        if (dist == "L" & n.boots <= 0) {
            med <- exp(untransformed.fit.params[1])
            disp <- exp(untransformed.fit.params[2])
            norm.quants <- qnorm(ptiles.appended)
            ests <- c(untransformed.fit.params[1], untransformed.fit.params[2], 
                med * disp^norm.quants)
            Sig <- solve(tmp$hessian)
            ses <- dic.getSE(dat = dat, par1 = log(med), log.par2 = log(log(disp)), 
                Sig = Sig, ptiles = ptiles.appended, dist = dist, 
                opt.method = opt.method)
            cil <- ests - qt(0.975, n - 1) * ses
            cih <- ests + qt(0.975, n - 1) * ses
            quant.matrix <- matrix(c(ests, cil, cih, ses), nrow = 2 + 
                length(ptiles.appended), byrow = FALSE)
            ptiles.names <- paste0("p", 100 * ptiles.appended)
            rownames(quant.matrix) <- c("meanlog", "sdlog", ptiles.names)
            colnames(quant.matrix) <- c("est", "CIlow", "CIhigh", 
                "StdErr")
        }
        else if (dist == "W" & n.boots <= 0) {
            shape <- untransformed.fit.params[1]
            scale <- untransformed.fit.params[2]
            ests <- c(shape, scale, scale * (-log(1 - ptiles.appended))^(1/shape))
            Sig <- solve(tmp$hessian)
            ses <- dic.getSE(dat = dat, par1 = shape, log.par2 = log(scale), 
                Sig = Sig, ptiles = ptiles.appended, dist = dist, 
                opt.method = opt.method)
            cil <- ests - qt(0.975, n - 1) * ses
            cih <- ests + qt(0.975, n - 1) * ses
            quant.matrix <- matrix(c(ests, cil, cih, ses), nrow = 2 + 
                length(ptiles.appended), byrow = FALSE)
            ptiles.names <- paste0("p", 100 * ptiles.appended)
            rownames(quant.matrix) <- c("shape", "scale", ptiles.names)
            colnames(quant.matrix) <- c("est", "CIlow", "CIhigh", 
                "StdErr")
        }
        else {
            Sig <- solve(tmp$hessian)
            boot.params <- dic.get.boots(dat = dat, par1 = untransformed.fit.params[1], 
                par2 = untransformed.fit.params[2], dist = dist, 
                opt.method = opt.method, n.boots = n.boots)
            na.rows <- is.na(rowSums(boot.params))
            if (sum(na.rows) > 0) {
                warning(sprintf("Could not estimate the MLEs for %.0f of %.0f bootstrap replications. Excluding these from the calculation of confidence intervals and standard errors so interpret with caution. \n", 
                  sum(na.rows), n.boots))
                boot.params <- boot.params[-which(na.rows), ]
            }
            cis.params <- apply(boot.params, 2, function(x) quantile(x, 
                c(0.025, 0.975)))
            if (dist == "L") {
                boot.funcs <- apply(boot.params, 1, function(x) qlnorm(ptiles.appended, 
                  meanlog = x[1], sdlog = x[2]))
                ests <- qlnorm(ptiles.appended, untransformed.fit.params[1], 
                  untransformed.fit.params[2])
                param1.name <- "meanlog"
                param2.name <- "sdlog"
            }
            else if (dist == "W") {
                boot.funcs <- apply(boot.params, 1, function(x) qweibull(ptiles.appended, 
                  shape = x[1], scale = x[2]))
                ests <- qweibull(ptiles.appended, shape = untransformed.fit.params[1], 
                  scale = untransformed.fit.params[2])
                param1.name <- "shape"
                param2.name <- "scale"
            }
            else if (dist == "G") {
                boot.funcs <- apply(boot.params, 1, function(x) qgamma(ptiles.appended, 
                  shape = x[1], scale = x[2]))
                ests <- qgamma(ptiles.appended, shape = untransformed.fit.params[1], 
                  scale = untransformed.fit.params[2])
                param1.name <- "shape"
                param2.name <- "scale"
            }
            sds.params <- apply(boot.params, 2, sd)
            cis.ptiles <- apply(boot.funcs, 1, function(x) quantile(x, 
                c(0.025, 0.975)))
            sds.ptiles <- apply(boot.funcs, 1, sd)
            quant.matrix <- matrix(c(untransformed.fit.params, 
                ests, cis.params[1, ], cis.ptiles[1, ], cis.params[2, 
                  ], cis.ptiles[2, ], sds.params, sds.ptiles), 
                nrow = 2 + length(ptiles.appended), byrow = FALSE)
            ptiles.names <- paste0("p", 100 * ptiles.appended)
            rownames(quant.matrix) <- c(param1.name, param2.name, 
                ptiles.names)
            colnames(quant.matrix) <- c("est", "CIlow", "CIhigh", 
                "SD")
        }
        if ("boot.params" %in% ls()) {
            bp <- data.frame(boot.params)
            ci.method <- "Bootstrap"
        }
        else {
            bp <- data.frame()
            ci.method <- "Asymptotic"
        }
        return(new("cd.fit", ests = round(quant.matrix, 3), conv = 1, 
            MSG = "", loglik = -tmp$value, samples = bp, data = data.frame(dat), 
            dist = dist, inv.hessian = Sig, est.method = "Maximum Likelihood - optim", 
            ci.method = ci.method))
    }
    else {
        return(new("cd.fit", ests = matrix(NA, nrow = 5, ncol = 4), 
            conv = 0, MSG = msg, loglik = numeric(0), samples = data.frame(), 
            data = data.frame(dat), dist = dist, inv.hessian = matrix(), 
            est.method = "Maximum Likelihood - optim", ci.method = ""))
    }
}
<bytecode: 0x9b52900>
<environment: namespace:coarseDataTools>
 --- function search by body ---
Function dic.fit in namespace coarseDataTools has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1