# NOT RUN {
wd_images_ID <- system.file("pictures/sample_images", package = "camtrapR")
if (Sys.which("exiftool") != ""){ # only run these examples if ExifTool is available
rec.db1 <- recordTable(inDir = wd_images_ID,
IDfrom = "directory",
minDeltaTime = 60,
deltaTimeComparedTo = "lastRecord",
writecsv = FALSE,
additionalMetadataTags = c("EXIF:Model", "EXIF:Make")
)
# note argument additionalMetadataTags: it contains tag names as returned by function exifTagNames
rec.db2 <- recordTable(inDir = wd_images_ID,
IDfrom = "directory",
minDeltaTime = 60,
deltaTimeComparedTo = "lastRecord",
exclude = "NO_ID",
writecsv = FALSE,
timeZone = "Asia/Kuala_Lumpur",
additionalMetadataTags = c("EXIF:Model", "EXIF:Make", "NonExistingTag")
)
# note the warning that the last tag in "additionalMetadataTags" was not found
any(rec.db1$Species == "NO_ID")
any(rec.db2$Species == "NO_ID")
#############
# here's how the removeDuplicateRecords argument works
# }
# NOT RUN {
# this is because otherwise the test would run too long to pass CRAN tests
rec.db3a <- recordTable(inDir = wd_images_ID,
IDfrom = "directory",
minDeltaTime = 0,
exclude = "NO_ID",
timeZone = "Asia/Kuala_Lumpur",
removeDuplicateRecords = FALSE
)
rec.db3b <- recordTable(inDir = wd_images_ID,
IDfrom = "directory",
minDeltaTime = 0,
exclude = "NO_ID",
timeZone = "Asia/Kuala_Lumpur",
removeDuplicateRecords = TRUE
)
anyDuplicated(rec.db3a[, c("Station", "Species", "DateTimeOriginal")]) # got duplicates
anyDuplicated(rec.db3b[, c("Station", "Species", "DateTimeOriginal")]) # no duplicates
# after removing duplicates, both are identical:
whichAreDuplicated <- which(duplicated(rec.db3a[, c("Station", "Species", "DateTimeOriginal")]))
all(rec.db3a[-whichAreDuplicated,] == rec.db3b)
# }
# NOT RUN {
} else { # show function output if ExifTool is not available
message("ExifTool is not available. Cannot test function")
data(recordTableSample)
}
# }
Run the code above in your browser using DataLab