Error(s) in re-building vignettes:
  ...
--- re-building ‘DataExploration.Rmd’ using rmarkdown
Loading required package: sp
rgdal: version: 1.4-7, (SVN revision 845)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 2.4.3, released 2019/10/28
 Path to GDAL shared files: /usr/share/gdal
 GDAL binary built with GEOS: TRUE 
 Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621]
 Path to PROJ.4 shared files: (autodetected)
 Linking to sp version: 1.3-2 
--- finished re-building ‘DataExploration.Rmd’

--- re-building ‘DataExtraction.Rmd’ using rmarkdown
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
camtrapR
 --- call from context --- 
spatialDetectionHistory(recordTableIndividual = recordTableIndividualSample, 
    species = "LeopardCat", output = "binary", camOp = camop_problem, 
    CTtable = camtraps, stationCol = "Station", speciesCol = "Species", 
    Xcol = "utm_x", Ycol = "utm_y", individualCol = "Individual", 
    recordDateTimeCol = "DateTimeOriginal", recordDateTimeFormat = "%Y-%m-%d %H:%M:%S", 
    occasionLength = 10, day1 = "survey", includeEffort = TRUE, 
    timeZone = "Asia/Kuala_Lumpur")
 --- call from argument --- 
if (class(secr::usage(secr.traps)) == "matrix") {
    noccasions <- ncol(secr::usage(secr.traps))
} else {
    noccasions <- ncol(effort)
}
 --- R stacktrace ---
where 1: spatialDetectionHistory(recordTableIndividual = recordTableIndividualSample, 
    species = "LeopardCat", output = "binary", camOp = camop_problem, 
    CTtable = camtraps, stationCol = "Station", speciesCol = "Species", 
    Xcol = "utm_x", Ycol = "utm_y", individualCol = "Individual", 
    recordDateTimeCol = "DateTimeOriginal", recordDateTimeFormat = "%Y-%m-%d %H:%M:%S", 
    occasionLength = 10, day1 = "survey", includeEffort = TRUE, 
    timeZone = "Asia/Kuala_Lumpur")
where 2: eval(expr, envir, enclos)
where 3: eval(expr, envir, enclos)
where 4: withVisible(eval(expr, envir, enclos))
where 5: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, 
    error = eHandler, message = mHandler)
where 6: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, 
    enclos)), warning = wHandler, error = eHandler, message = mHandler))
where 7: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, 
    envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
where 8: 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 9: evaluate::evaluate(...)
where 10: 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 11: 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 12: block_exec(params)
where 13: call_block(x)
where 14: process_group.block(group)
where 15: process_group(group)
where 16: 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 17: process_file(text, output)
where 18: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet, 
    encoding = encoding)
where 19: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(), 
    ...)
where 20: vweave_rmarkdown(...)
where 21: engine$weave(file, quiet = quiet, encoding = enc)
where 22: doTryCatch(return(expr), name, parentenv, handler)
where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 24: tryCatchList(expr, classes, parentenv, handlers)
where 25: 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)
    }
}, error = function(e) {
    OK <<- FALSE
    message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s", 
        file, conditionMessage(e)))
})
where 26: tools:::.buildOneVignette("DataExtraction.Rmd", "/home/hornik/tmp/R.check/r-devel-gcc/Work/PKGS/camtrapR.Rcheck/vign_test/camtrapR", 
    TRUE, FALSE, "DataExtraction", "UTF-8", "/home/hornik/tmp/scratch/RtmpSaJW41/file38e55236e616.rds")

 --- value of length: 2 type: logical ---
[1]  TRUE FALSE
 --- function from context --- 
function (recordTableIndividual, species, camOp, CTtable, output = c("binary", 
    "count"), stationCol = "Station", speciesCol = "Species", 
    sessionCol, Xcol, Ycol, stationCovariateCols, individualCol, 
    individualCovariateCols, recordDateTimeCol = "DateTimeOriginal", 
    recordDateTimeFormat = "%Y-%m-%d %H:%M:%S", occasionLength, 
    minActiveDaysPerOccasion, occasionStartTime = 0, maxNumberDays, 
    day1, buffer, includeEffort = TRUE, scaleEffort = FALSE, 
    binaryEffort = FALSE, timeZone, makeRMarkInput) 
{
    wd0 <- getwd()
    on.exit(setwd(wd0))
    stopifnot(hasArg(recordTableIndividual))
    if (class(recordTableIndividual) != "data.frame") 
        stop("recordTableIndividual must be a data.frame", call. = FALSE)
    stopifnot(hasArg(camOp))
    stopifnot(hasArg(species))
    stopifnot(is.character(species))
    stopifnot(length(species) == 1)
    if (hasArg(makeRMarkInput)) 
        stopifnot(is.logical(makeRMarkInput))
    output <- match.arg(output)
    stopifnot(hasArg(occasionLength))
    stopifnot(c(speciesCol, recordDateTimeCol, stationCol, individualCol) %in% 
        colnames(recordTableIndividual))
    checkForSpacesInColumnNames(stationCol = stationCol, Xcol = Xcol, 
        Ycol = Ycol, recordDateTimeCol = recordDateTimeCol, speciesCol = speciesCol, 
        individualCol)
    if (class(CTtable) != "data.frame") 
        stop("CTtable must be a data.frame", call. = FALSE)
    if (!stationCol %in% colnames(CTtable)) 
        stop(paste("stationCol = \"", stationCol, "\" is not a column name in CTtable", 
            sep = ""), call. = FALSE)
    if (!Xcol %in% colnames(CTtable)) 
        stop(paste("Xcol = \"", Xcol, "\" is not a column name in CTtable", 
            sep = ""), call. = FALSE)
    if (!Ycol %in% colnames(CTtable)) 
        stop(paste("Ycol = \"", Ycol, "\" is not a column name in CTtable", 
            sep = ""), call. = FALSE)
    if (!stationCol %in% colnames(recordTableIndividual)) 
        stop(paste("stationCol = \"", stationCol, "\" is not a column name in recordTableIndividual", 
            sep = ""), call. = FALSE)
    if (!recordDateTimeCol %in% colnames(recordTableIndividual)) 
        stop(paste("recordDateTimeCol = \"", recordDateTimeCol, 
            "\" is not a column name in recordTableIndividual", 
            sep = ""), call. = FALSE)
    if (!speciesCol %in% colnames(recordTableIndividual)) 
        stop(paste("speciesCol = \"", speciesCol, "\" is not a column name in recordTableIndividual", 
            sep = ""), call. = FALSE)
    if (!individualCol %in% colnames(recordTableIndividual)) 
        stop(paste("individualCol = \"", individualCol, "\" is not a column name in recordTableIndividual", 
            sep = ""), call. = FALSE)
    stopifnot(length(stationCol) == 1)
    recordTableIndividual[, stationCol] <- as.character(recordTableIndividual[, 
        stationCol])
    stopifnot(is.character(stationCol))
    stopifnot(length(speciesCol) == 1)
    recordTableIndividual[, speciesCol] <- as.character(recordTableIndividual[, 
        speciesCol])
    stopifnot(is.character(speciesCol))
    stopifnot(length(individualCol) == 1)
    recordTableIndividual[, individualCol] <- as.character(recordTableIndividual[, 
        individualCol])
    stopifnot(is.character(individualCol))
    stopifnot(length(recordDateTimeCol) == 1)
    recordTableIndividual[, recordDateTimeCol] <- as.character(recordTableIndividual[, 
        recordDateTimeCol])
    stopifnot(is.character(recordDateTimeCol))
    if (any(is.na(CTtable[, Xcol]))) 
        stop("there are NAs in Xcol")
    if (any(is.na(CTtable[, Ycol]))) 
        stop("there are NAs in Ycol")
    if (any(is.na(CTtable[, stationCol]))) 
        stop("there are NAs in stationCol of CTtable")
    if (hasArg(stationCovariateCols)) {
        checkForSpacesInColumnNames(stationCovariateCols = stationCovariateCols)
        if (!all(stationCovariateCols %in% colnames(CTtable))) 
            stop("did not find stationCovariateCols in column names of CTtable (", 
                paste(stationCovariateCols[which(stationCovariateCols %in% 
                  colnames(CTtable) == FALSE)], collapse = ", "), 
                ")", sep = "", call. = FALSE)
    }
    if (!all(recordTableIndividual$Station %in% CTtable$Station)) 
        stop("there are entries in stationCol of recordTableIndividual that are not found in stationCol of CTtable")
    if (hasArg(sessionCol)) {
        checkForSpacesInColumnNames(sessionCol = sessionCol)
        if (sessionCol %in% colnames(recordTableIndividual) & 
            sessionCol %in% colnames(CTtable)) 
            stop(paste("both CTtable and recordTableIndividual contain sessionCol '", 
                sessionCol, "'", sep = ""), call. = FALSE)
        if (sessionCol %in% colnames(recordTableIndividual) == 
            FALSE & sessionCol %in% colnames(CTtable) == FALSE) 
            stop(paste("neither CTtable nor recordTableIndividual contain sessionCol '", 
                sessionCol, "'", sep = ""), call. = FALSE)
        if (sessionCol %in% colnames(recordTableIndividual)) {
            stopifnot(is.numeric(recordTableIndividual[, sessionCol]))
            if (!all(sort(unique(recordTableIndividual[, sessionCol])) == 
                seq.int(from = 1, to = max(recordTableIndividual[, 
                  sessionCol]), by = 1))) 
                stop("Problem in sessionCol: Values must come from a gapless sequence of integer numbers starting with 1", 
                  call. = FALSE)
        }
        if (sessionCol %in% colnames(CTtable)) {
            stopifnot(is.numeric(CTtable[, sessionCol]))
            if (!all(sort(unique(CTtable[, sessionCol])) == seq.int(from = 1, 
                to = max(CTtable[, sessionCol]), by = 1))) 
                stop("Problem in sessionCol: Values must come from a gapless sequence of integer numbers starting with 1", 
                  call. = FALSE)
            recordTableIndividual <- merge(recordTableIndividual, 
                CTtable[, c(stationCol, sessionCol)], by = stationCol)
        }
    }
    if (any(CTtable[, stationCol] != rownames(camOp))) 
        stop("there is a mismatch between station IDs in CTtable and rownames in camOp")
    if (hasArg(timeZone) == FALSE) {
        warning("timeZone is not specified. Assuming UTC", call. = FALSE)
        timeZone <- "UTC"
    }
    if (!is.element(timeZone, OlsonNames())) {
        stop("timeZone must be an element of OlsonNames()")
    }
    if (hasArg(minActiveDaysPerOccasion)) {
        stopifnot(is.numeric(minActiveDaysPerOccasion))
        stopifnot(minActiveDaysPerOccasion <= occasionLength)
    }
    if (length(occasionStartTime) != 1) 
        stop("occasionStartTime must have length 1")
    occasionStartTime <- as.integer(round(occasionStartTime))
    if (occasionStartTime != 0 & !is.integer(occasionStartTime)) 
        stop("occasionStartTime must be between 0 and 23")
    if (occasionStartTime < 0 | occasionStartTime >= 24) 
        stop("occasionStartTime must be between 0 and 23")
    occasionLength <- as.integer(round(occasionLength))
    if (occasionLength <= 0) 
        stop("occasionLength must be a positive integer and not 0")
    if (occasionLength > ncol(camOp)/2) 
        stop("occasionLength may not be greater than half the total number of days in camOp")
    stopifnot(is.numeric(occasionLength))
    if (hasArg(maxNumberDays)) {
        maxNumberDays <- as.integer(maxNumberDays)
        if (maxNumberDays > ncol(camOp)) 
            stop("maxNumberDays must be smaller than the number of columns of camOp")
        if (maxNumberDays < occasionLength) 
            stop("maxNumberDays must be larger than or equal to occasionLength")
    }
    if (hasArg(buffer)) {
        stopifnot(is.numeric(buffer))
        buffer <- round(buffer)
        stopifnot(buffer >= 1)
    }
    if (species %in% recordTableIndividual[, speciesCol] == FALSE) 
        stop("species is not in speciesCol of recordTableIndividual")
    if (all(recordTableIndividual[, stationCol] %in% CTtable[, 
        stationCol]) == FALSE) {
        stop(paste("items of stationCol in recordTableIndividual are not matched in stationCol of CTtable: ", 
            paste(recordTableIndividual[-which(recordTableIndividual[, 
                stationCol] %in% CTtable[, stationCol]), stationCol], 
                collapse = ", ")))
    }
    if (includeEffort == TRUE) {
        if (hasArg(scaleEffort)) {
            if (class(scaleEffort) != "logical") 
                stop("scaleEffort must be logical (currently only FALSE is allowed)")
            if (isTRUE(scaleEffort)) 
                stop("currently scaleEffort must be FALSE")
        }
        if (hasArg(binaryEffort)) {
            if (class(binaryEffort) != "logical") 
                stop("binaryEffort must be logical (TRUE or FALSE)")
        }
        if (binaryEffort == TRUE & scaleEffort == TRUE) 
            stop("'scaleEffort' and 'binaryEffort' cannot both be TRUE")
    }
    else {
        scaleEffort <- FALSE
        binaryEffort <- FALSE
    }
    subset_species <- recordTableIndividual[recordTableIndividual[, 
        speciesCol] == species, ]
    subset_species$DateTime2 <- as.POSIXlt(subset_species[, recordDateTimeCol], 
        tz = timeZone, format = recordDateTimeFormat)
    if (hasArg(sessionCol)) {
        if (sessionCol %in% colnames(CTtable)) {
            rec_station_session <- unique(subset_species[, c(stationCol, 
                sessionCol)])
            cam_station_session <- unique(CTtable[, c(stationCol, 
                sessionCol)])
            rec_station_session$included_rec <- TRUE
            cam_station_session$included_station <- TRUE
            merged_tmp <- merge(rec_station_session, cam_station_session, 
                all = TRUE)
            if (any(is.na(merged_tmp$included_station))) {
                which_to_remove_mismatch <- which(subset_species[, 
                  stationCol] == merged_tmp[is.na(merged_tmp$included_station), 
                  stationCol] & subset_species[, sessionCol] == 
                  merged_tmp[is.na(merged_tmp$included_station), 
                    sessionCol])
                if (length(which_to_remove_mismatch) >= 1) {
                  warning("there are records at stations which were not used during sessions. They will be ignored. \nrows: ", 
                    paste(rownames(subset_species)[which_to_remove_mismatch], 
                      collapse = ", "), call. = FALSE)
                  subset_species <- subset_species[-which_to_remove_mismatch, 
                    ]
                }
            }
        }
    }
    stopifnot(class(day1) == "character")
    if (day1 == "survey") {
        day1switch <- 1
    }
    else {
        if (day1 == "station") {
            day1switch <- 2
        }
        else {
            try(date.test <- as.Date(day1), silent = TRUE)
            if (!exists("date.test")) 
                stop("day1 is not specified correctly. It can only be 'station', 'survey', or a date formatted as 'YYYY-MM-DD', e.g. '2016-12-31'")
            if (class(date.test) != "Date") 
                stop("could not interpret argument day1: can only be \"station\", \"survey\" or a specific date (e.g. \"2015-12-31\")")
            if (hasArg(buffer)) 
                stop("if buffer is defined, day1 can only be 'survey' or 'station'")
            suppressWarnings(rm(date.test))
            day1switch <- 3
        }
    }
    if ("POSIXlt" %in% class(subset_species$DateTime2) == FALSE) 
        stop("couldn't interpret recordDateTimeCol of recordTableIndividual using specified recordDateTimeFormat")
    if (any(is.na(subset_species$DateTime2))) 
        stop("at least 1 entry in recordDateTimeCol of recordTableIndividual could not be interpreted using recordDateTimeFormat")
    checkCamOpColumnNames(cameraOperationMatrix = camOp)
    cam.op.worked0 <- as.matrix(camOp)
    if (all(as.character(unique(subset_species[, stationCol])) %in% 
        rownames(cam.op.worked0)) == FALSE) {
        (stop("Not all values of stationCol in recordTableIndividual are matched by rownames of camOp"))
    }
    arg.list0 <- list(cam.op = cam.op.worked0, subset_species_tmp = subset_species, 
        stationCol_tmp = stationCol, day1_tmp = day1, occasionStartTime_tmp = occasionStartTime, 
        timeZone_tmp = timeZone)
    if (hasArg(maxNumberDays)) 
        arg.list0 <- c(arg.list0, maxNumberDays_tmp = maxNumberDays)
    if (hasArg(buffer)) 
        arg.list0 <- c(arg.list0, buffer_tmp = buffer)
    date_ranges <- do.call(createDateRangeTable, arg.list0)
    rm(arg.list0)
    cam.op.worked <- adjustCameraOperationMatrix(cam.op = cam.op.worked0, 
        date_ranges2 = date_ranges, timeZone_tmp = timeZone, 
        day1_2 = day1)
    if (occasionStartTime != 0) {
        colnames(cam.op.worked) <- paste(colnames(cam.op.worked), 
            "+", occasionStartTime, "h", sep = "")
    }
    arg.list0 <- list(cam.op = cam.op.worked, occasionLength2 = occasionLength, 
        scaleEffort2 = scaleEffort, includeEffort2 = includeEffort)
    if (hasArg(minActiveDaysPerOccasion)) 
        arg.list0 <- c(arg.list0, minActiveDaysPerOccasion2 = minActiveDaysPerOccasion)
    effort.tmp <- do.call(calculateTrappingEffort, arg.list0)
    rm(arg.list0)
    effort <- effort.tmp[[1]]
    if (isTRUE(scaleEffort)) 
        scale.eff.tmp.attr <- effort.tmp[[2]]
    if (isTRUE(binaryEffort)) 
        effort <- ifelse(effort >= 1, 1, 0)
    subset_species <- cleanSubsetSpecies(subset_species2 = subset_species, 
        stationCol2 = stationCol, date_ranges2 = date_ranges)
    if (day1 %in% c("survey")) {
        time2 <- date_ranges$start_first_occasion_survey[match(subset_species[, 
            stationCol], rownames(date_ranges))]
    }
    else {
        time2 <- date_ranges$start_first_occasion[match(subset_species[, 
            stationCol], rownames(date_ranges))]
    }
    occasionCol <- "Occasion"
    subset_species[, occasionCol] <- as.numeric(ceiling((difftime(time1 = subset_species$DateTime2, 
        time2 = time2, units = "secs", tz = timeZone)/(occasionLength * 
        86400))))
    if (max(subset_species[, occasionCol]) > ncol(effort)) {
        stop("encountered a bug. I'm Sorry. Please report it.")
    }
    if (includeEffort == TRUE) {
        colnames(effort) <- paste("o", seq(1, ncol(effort), by = 1), 
            sep = "")
    }
    if (hasArg(individualCovariateCols)) {
        sdh0 <- subset_species[, c(individualCol, occasionCol, 
            stationCol, individualCovariateCols)]
        colnames(sdh0) <- c("ID", occasionCol, "trapID", individualCovariateCols)
    }
    else {
        sdh0 <- subset_species[, c(individualCol, occasionCol, 
            stationCol)]
        colnames(sdh0) <- c("ID", occasionCol, "trapID")
    }
    if (hasArg(sessionCol)) {
        sdh1 <- cbind(Session = subset_species[, sessionCol], 
            sdh0)
    }
    else {
        sdh1 <- cbind(Session = 1, sdh0)
    }
    remove.tmp <- which(is.na(sdh1[, "ID"]))
    if (length(remove.tmp) >= 1) {
        sdh1 <- sdh1[-remove.tmp, ]
        warning(paste("removed", length(remove.tmp), "records because of missing individual IDs"), 
            call. = FALSE)
    }
    if (output == "binary") {
        sdh2 <- unique(sdh1)
    }
    else {
        sdh2 <- sdh1
    }
    rowindex_sdh_to_remove <- vector()
    for (rowindex_sdh in 1:nrow(sdh2)) {
        if (is.na(effort[match(sdh2$trapID[rowindex_sdh], rownames(effort)), 
            sdh2$Occasion[rowindex_sdh]]) | effort[match(sdh2$trapID[rowindex_sdh], 
            rownames(effort)), sdh2$Occasion[rowindex_sdh]] == 
            0) {
            rowindex_sdh_to_remove <- c(rowindex_sdh_to_remove, 
                rowindex_sdh)
        }
    }
    if (length(rowindex_sdh_to_remove) != 0) {
        warning(paste("removed ", length(rowindex_sdh_to_remove), 
            " record(s) because of effort = 0/NA, incomplete occasions (if includeEffort = FALSE), or effort < minActiveDaysPerOccasion \n(rownames: ", 
            paste(rownames(sdh2)[rowindex_sdh_to_remove], collapse = ", "), 
            ")", sep = ""), call. = FALSE)
        sdh2 <- sdh2[-rowindex_sdh_to_remove, ]
    }
    rm(rowindex_sdh, rowindex_sdh_to_remove)
    effort[which(is.na(effort))] <- 0
    coord.ct <- CTtable[, c(Xcol, Ycol)]
    colnames(coord.ct) <- c("x", "y")
    rownames(coord.ct) <- CTtable[, stationCol]
    detectortype <- ifelse(output == "binary", "proximity", "count")
    if (hasArg(stationCovariateCols)) {
        whichstationCovariateCols <- which(colnames(CTtable) %in% 
            stationCovariateCols)
        stationCovsDF <- data.frame(CTtable[, whichstationCovariateCols])
        if (length(stationCovariateCols) == 1) {
            colnames(stationCovsDF) <- stationCovariateCols
        }
    }
    if (hasArg(sessionCol)) {
        if (sessionCol %in% colnames(CTtable)) {
            secr.traps <- list()
            if (any(table(CTtable[, sessionCol]) == 1)) 
                stop("there is a session in CTtable that has only one station.")
            for (sessionID in 1:max(CTtable[, sessionCol])) {
                which.session.tmp <- which(CTtable[, sessionCol] == 
                  sessionID)
                if (includeEffort == TRUE) {
                  secr.traps[[sessionID]] <- read.traps(data = coord.ct[which.session.tmp, 
                    ], detector = detectortype, binary.usage = binaryEffort)
                  effort_session_tmp <- effort[which.session.tmp, 
                    ]
                  secr::usage(secr.traps[[sessionID]]) <- effort_session_tmp[, 
                    which(colSums(effort_session_tmp) != 0)]
                  sdh2[sdh2[, "Session"] == sessionID, "Occasion"] <- sapply(sdh2[sdh2[, 
                    "Session"] == sessionID, "Occasion"], FUN = function(x) {
                    x - length(which(which(colSums(effort_session_tmp) == 
                      0) < x) == TRUE)
                  })
                  rm(effort_session_tmp)
                }
                else {
                  secr.traps[[sessionID]] <- read.traps(data = coord.ct[which.session.tmp, 
                    ], detector = detectortype)
                }
                if (exists("stationCovsDF")) 
                  secr::covariates(secr.traps[[sessionID]]) <- stationCovsDF[which.session.tmp, 
                    ]
                rm(which.session.tmp)
            }
            if (any(sapply(secr::usage(secr.traps), sum) == 0)) {
                if (day1switch == 3) {
                  warning("will remove data from session  ", 
                    paste(which(sapply(secr::usage(secr.traps), 
                      sum) == 0), collapse = ", "), "  because the effort matrix was empty.\n                  This is probably due to the usage of a date outside the station operation range in argument 'day1'", 
                    call. = FALSE)
                }
                else {
                  warning("will remove data from ", paste(which(sapply(usage(secr.traps), 
                    sum) == 0), collapse = ", "), " session because the effort matrix was empty.", 
                    call. = FALSE)
                }
                secr.traps <- secr.traps[-which(sapply(secr::usage(secr.traps), 
                  sum) == 0)]
            }
        }
    }
    if (!exists("secr.traps")) {
        if (includeEffort == TRUE) {
            secr.traps <- read.traps(data = coord.ct, detector = detectortype, 
                binary.usage = binaryEffort)
            secr::usage(secr.traps) <- effort[, which(colSums(effort) != 
                0)]
            sdh2$Occasion <- sapply(sdh2$Occasion, FUN = function(x) {
                x - length(which(which(colSums(effort) == 0) < 
                  x) == TRUE)
            })
        }
        else {
            secr.traps <- read.traps(data = coord.ct, detector = detectortype)
        }
        if (exists("stationCovsDF")) 
            secr::covariates(secr.traps) <- stationCovsDF
    }
    if (includeEffort == FALSE) {
        noccasions <- ncol(effort)
    }
    else {
        if (all(class(secr.traps) == "list")) {
            noccasions <- sapply(secr::usage(secr.traps), ncol)
        }
        else {
            if (class(secr::usage(secr.traps)) == "matrix") {
                noccasions <- ncol(secr::usage(secr.traps))
            }
            else {
                noccasions <- ncol(effort)
            }
        }
    }
    capthist.secr <- make.capthist(captures = sdh2, traps = secr.traps, 
        fmt = "trapID", noccasions = noccasions, bysession = TRUE)
    if (hasArg(makeRMarkInput)) {
        if (isTRUE(makeRMarkInput)) {
            RMarkDataframe <- RMarkInput(capthist.secr, covariates = TRUE)
            return(RMarkDataframe)
        }
    }
    return(capthist.secr)
}
<bytecode: 0x55c6b0722040>
<environment: namespace:camtrapR>
 --- function search by body ---
Function spatialDetectionHistory in namespace camtrapR has this body.
Function spatialDetectionHistory in namespace camtrapR has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1
--- re-building ‘ImageOrganisation.Rmd’ using rmarkdown
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/raw_images/StationA/IMG0002.JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/raw_images/StationA/IMG0003.JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/raw_images/StationA/IMG0001.JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/raw_images/StationB/IMG0002.JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/raw_images/StationB/IMG0003.JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/raw_images/StationB/IMG0001.JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationA/PBE/StationA__2009-04-23__00-09-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationA/PBE/StationA__2009-04-21__00-40-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationA/PBE/StationA__2009-04-22__20-21-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationA/PBE/StationA__2009-05-07__17-11-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationA/PBE/StationA__2009-04-22__20-19-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationA/PBE/StationA__2009-04-23__00-07-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationA/VTA/StationA__2009-04-10__05-07-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationA/VTA/StationA__2009-05-06__19-06-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/MNE/StationB__2009-04-28__17-47-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/MNE/StationB__2009-04-28__17-47-00(2).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/MNE/StationB__2009-04-28__17-49-00(2).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/MNE/StationB__2009-04-28__17-49-00(3).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/MNE/StationB__2009-04-15__07-21-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/MNE/StationB__2009-04-28__17-48-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/MNE/StationB__2009-04-28__17-48-00(3).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/MNE/StationB__2009-04-15__07-23-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/MNE/StationB__2009-04-28__17-49-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/MNE/StationB__2009-04-28__17-48-00(2).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/PBE/StationB__2009-04-25__04-33-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/PBE/StationB__2009-04-24__22-54-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/PBE/StationB__2009-04-05__23-13-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/PBE/StationB__2009-04-05__00-11-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/PBE/StationB__2009-04-07__00-23-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/PBE/StationB__2009-05-14__02-11-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/PBE/StationB__2009-04-14__06-13-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/PBE/StationB__2009-04-25__04-33-00(2).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/PBE/StationB__2009-04-10__04-07-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/PBE/StationB__2009-04-10__04-08-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/VTA/StationB__2009-04-15__19-12-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/VTA/StationB__2009-04-27__05-07-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationB/NO_ID/StationB__2009-05-07__18-45-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/PBE/StationC__2009-05-05__18-25-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/PBE/StationC__2009-04-18__22-57-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/PBE/StationC__2009-04-23__03-33-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/PBE/StationC__2009-04-06__03-00-00(2).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/PBE/StationC__2009-04-14__23-30-00(2).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/PBE/StationC__2009-04-23__03-34-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/PBE/StationC__2009-04-06__03-00-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/PBE/StationC__2009-05-07__18-47-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/PBE/StationC__2009-04-14__23-30-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/PBE/StationC__2009-05-05__18-24-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/EGY/StationC__2009-04-25__03-09-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/EGY/StationC__2009-04-23__02-25-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/EGY/StationC__2009-04-12__20-26-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/EGY/StationC__2009-04-06__03-49-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/EGY/StationC__2009-04-27__00-17-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/EGY/StationC__2009-04-12__20-26-00(2).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/EGY/StationC__2009-04-23__02-27-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/EGY/StationC__2009-05-02__03-35-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/EGY/StationC__2009-05-02__03-36-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-04-24__19-26-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-04-27__00-19-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-05-02__00-10-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-04-11__21-46-00(2).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-04-14__00-18-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-05-12__02-34-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-04-11__21-46-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-05-01__20-10-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-04-11__21-44-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-05-12__02-32-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-04-13__22-38-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-04-14__00-18-00(2).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-04-13__22-38-00(2).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-05-02__00-11-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-05-01__20-12-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-04-27__00-20-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/TRA/StationC__2009-04-24__19-27-00(1).JPG
Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - /home/hornik/tmp/scratch/RtmpsdkGhk/sample_images/StationC/VTA/StationC__2009-04-24__02-57-00(1).JPG
--- finished re-building ‘ImageOrganisation.Rmd’

--- re-building ‘SpeciesIndividualIdentification.Rmd’ using rmarkdown
--- finished re-building ‘SpeciesIndividualIdentification.Rmd’

SUMMARY: processing the following file failed:
  ‘DataExtraction.Rmd’

Error: Vignette re-building failed.
Execution halted