R/filterRecordTable.R
filterRecordTable.Rd
Filter species record table for temporal independence
filterRecordTable(
recordTable,
minDeltaTime = 0,
deltaTimeComparedTo,
speciesCol = "Species",
stationCol,
cameraCol,
camerasIndependent,
recordDateTimeCol = "DateTimeOriginal",
recordDateTimeFormat = "ymd HMS",
removeDuplicateRecords = TRUE,
exclude,
timeZone,
writecsv = FALSE,
outDir,
eventSummaryColumn,
eventSummaryFunction,
quiet = FALSE
)
data frame as created by recordTable
.
integer. Time difference between records of the same species at the same station to be considered independent (in minutes)
character. For two records to be considered
independent, must the second one be at least minDeltaTime
minutes
after the last independent record of the same species
("lastIndependentRecord"
), or minDeltaTime
minutes after the
last record ("lastRecord"
)?
character. name of the column specifying species in
recordTable
character. Name of the camera trap station column. Assuming "Station" if undefined.
character. Name of the column specifying cameras in
recordTable
(optional).
logical. If TRUE
, species records are
considered to be independent between cameras at a station.
character. Name of the column specifying date and
time in recordTable
.
character. Format of column
recordDateTimeCol
in recordTable
logical. If there are several records of the same species at the same station (also same camera if cameraID is defined) at exactly the same time, show only one?
character. Vector of species names to be excluded from the record table
character. Must be a value returned by
OlsonNames
logical. Should the record table be saved as a .csv?
character. Directory to save csv to. If NULL and
writecsv = TRUE
, recordTable will be written to inDir
.
character. A column in the record table (e.g. from
a metadata tag) by to summarise non-independent records (those within
minDeltaTime
of a given record) with a user-defined function
(eventSummaryFunction
)
character. The function by which to summarise
eventSummaryColumn
of non-independent records, e.g. "sum", "max"
(optional)
logical. If TRUE, suppress printing of progress.
A data frame containing species records and additional information about stations, date, time, filtered for temporal independence.
if (Sys.which("exiftool") != ""){ # only run example if ExifTool is available
# set directory with camera trap images in station directories
wd_images_ID_species <- system.file("pictures/sample_images_species_dir",
package = "camtrapR")
# create record table without temporal filtering
rec_table <- recordTable(inDir = wd_images_ID_species,
IDfrom = "directory",
minDeltaTime = 0,
exclude = "UNID",
timeZone = "Asia/Kuala_Lumpur",
removeDuplicateRecords = TRUE
)
# filter for 60 minutes temporal independence
rec_table_filt <- filterRecordTable(recordTable = rec_table,
minDeltaTime = 60,
stationCol = "Station",
deltaTimeComparedTo = "lastIndependentRecord")
nrow(rec_table)
nrow(rec_table_filt)
}
#> StationA: 8 images 0 duplicates removed |======= | 33%
#> StationB: 22 images 6 duplicates removed |============= | 67%
#> StationC: 37 images 6 duplicates removed |====================| 100%
#> StationA: 8 images 0 duplicates removed |======= | 33%
#> StationB: 16 images 0 duplicates removed |============= | 67%
#> StationC: 31 images 0 duplicates removed |====================| 100%
#> [1] 39