data(camtraps)
data(recordTableSample)
# since version 2.1, camera operation matrix is required as input
camop_no_problem <- cameraOperation(CTtable = camtraps,
stationCol = "Station",
setupCol = "Setup_date",
retrievalCol = "Retrieval_date",
writecsv = FALSE,
hasProblems = FALSE,
dateFormat = "dmy"
)
reportTest <- surveyReport (recordTable = recordTableSample,
CTtable = camtraps,
camOp = camop_no_problem,
speciesCol = "Species",
stationCol = "Station",
setupCol = "Setup_date",
retrievalCol = "Retrieval_date",
CTDateFormat = "dmy",
recordDateTimeCol = "DateTimeOriginal",
recordDateTimeFormat = "ymd HMS")
class(reportTest) # a list with
length(reportTest) # 5 elements
reportTest[[1]] # camera trap operation times and image date ranges
reportTest[[2]] # number of species by station
reportTest[[3]] # number of events and number of stations by species
reportTest[[4]] # number of species events by station
reportTest[[5]] # number of species events by station including 0s (non-observed species)
# with camera problems
camop_problem <- cameraOperation(CTtable = camtraps,
stationCol = "Station",
setupCol = "Setup_date",
retrievalCol = "Retrieval_date",
writecsv = FALSE,
hasProblems = TRUE,
dateFormat = "dmy"
)
reportTest_problem <- surveyReport (recordTable = recordTableSample,
CTtable = camtraps,
camOp = camop_problem,
speciesCol = "Species",
stationCol = "Station",
setupCol = "Setup_date",
retrievalCol = "Retrieval_date",
CTDateFormat = "dmy",
recordDateTimeCol = "DateTimeOriginal",
recordDateTimeFormat = "ymd HMS")
reportTest_problem$survey_dates
## if camOp is missing, the legacy version (from 2.0.3) will be used:
reportTest_problem_old <- surveyReport (recordTable = recordTableSample,
CTtable = camtraps,
# camOp = camop_problem,
speciesCol = "Species",
stationCol = "Station",
setupCol = "Setup_date",
retrievalCol = "Retrieval_date",
CTDateFormat = "dmy",
recordDateTimeCol = "DateTimeOriginal",
recordDateTimeFormat = "ymd HMS")
if (FALSE) {
# run again with sinkpath defined
reportTest <- surveyReport (recordTable = recordTableSample,
CTtable = camtraps,
camOp = camop_no_problem,
speciesCol = "Species",
stationCol = "Station",
setupCol = "Setup_date",
retrievalCol = "Retrieval_date",
CTDateFormat = "dmy",,
recordDateTimeCol = "DateTimeOriginal",
recordDateTimeFormat = "ymd HMS",
sinkpath = getwd())
# have a look at the text file
readLines(list.files(getwd(), pattern = paste("survey_report_", Sys.Date(), ".txt", sep = ""),
full.names = TRUE))
}
Run the code above in your browser using DataLab