# NOT RUN {
# define image directory
wd_images_ID <- system.file("pictures/sample_images_species_dir", package = "camtrapR")
# load station information
data(camtraps)
# create camera operation matrix
camop_no_problem <- cameraOperation(CTtable = camtraps,
stationCol = "Station",
setupCol = "Setup_date",
retrievalCol = "Retrieval_date",
hasProblems = FALSE,
dateFormat = "dmy"
)
# }
# NOT RUN {
if (Sys.which("exiftool") != ""){ # only run this function if ExifTool is available
recordTableSample <- recordTable(inDir = wd_images_ID,
IDfrom = "directory",
minDeltaTime = 60,
deltaTimeComparedTo = "lastRecord",
exclude = "UNID",
timeZone = "Asia/Kuala_Lumpur"
)
}
# }
# NOT RUN {
data(recordTableSample) # load the record history, as created above
# compute detection history for a species
# without trapping effort
DetHist1 <- detectionHistory(recordTable = recordTableSample,
camOp = camop_no_problem,
stationCol = "Station",
speciesCol = "Species",
recordDateTimeCol = "DateTimeOriginal",
species = "VTA",
occasionLength = 7,
day1 = "station",
datesAsOccasionNames = FALSE,
includeEffort = FALSE,
timeZone = "Asia/Kuala_Lumpur"
)
DetHist1 # this is a list with 1 element
DetHist1$detection_history # this is the contained detection/non-detection matrix
# with effort / using base R to define recordDateTimeFormat
DetHist2 <- detectionHistory(recordTable = recordTableSample,
camOp = camop_no_problem,
stationCol = "Station",
speciesCol = "Species",
recordDateTimeCol = "DateTimeOriginal",
species = "VTA",
occasionLength = 7,
day1 = "station",
datesAsOccasionNames = FALSE,
includeEffort = TRUE,
scaleEffort = FALSE,
timeZone = "Asia/Kuala_Lumpur"
)
DetHist2$detection_history # detection history (alternatively, use: DetHist2[[1]])
DetHist2$effort # effort (alternatively, use: DetHist2[[2]])
# with effort / using lubridate package to define recordDateTimeFormat
DetHist2_lub <- detectionHistory(recordTable = recordTableSample,
camOp = camop_no_problem,
stationCol = "Station",
speciesCol = "Species",
recordDateTimeCol = "DateTimeOriginal",
recordDateTimeFormat = "ymd HMS",
species = "VTA",
occasionLength = 7,
day1 = "station",
datesAsOccasionNames = FALSE,
includeEffort = TRUE,
scaleEffort = FALSE,
timeZone = "Asia/Kuala_Lumpur"
)
DetHist2_lub$detection_history # detection history (alternatively, use: DetHist2_lub[[1]])
DetHist2_lub$effort # effort (alternatively, use: DetHist2_lub[[2]])
# multi-season detection history
# load multi-season data
data(camtrapsMultiSeason)
data(recordTableSampleMultiSeason)
# multi-season camera operation matrix
camop_season <- cameraOperation(CTtable = camtrapsMultiSeason,
stationCol = "Station",
setupCol = "Setup_date",
sessionCol = "session",
retrievalCol = "Retrieval_date",
hasProblems = TRUE,
dateFormat = "dmy"
)
# multi-season detection history
DetHist_multi <- detectionHistory(recordTable = recordTableSampleMultiSeason,
camOp = camop_season,
stationCol = "Station",
speciesCol = "Species",
species = "VTA",
occasionLength = 10,
day1 = "station",
recordDateTimeCol = "DateTimeOriginal",
includeEffort = TRUE,
scaleEffort = FALSE,
timeZone = "UTC",
unmarkedMultFrameInput = TRUE
)
DetHist_multi
# }
Run the code above in your browser using DataLab