Learn R Programming

camtrapR (version 0.98.0)

surveyReport: Create a report about camera trap surveys and species detections

Description

This function creates a report about camera trap surveys and species captures from a camera information table and a record database (generated with recordDatabase).

Usage

surveyReport (recordTable,
  CTtable,
  speciesCol = "Species",
  stationCol = "Station",
  cameraCol, 
  setupCol,
  retrievalCol,
  CTDateFormat = "%Y-%m-%d", 
  CTHasProblems = FALSE,
  recordDateTimeCol = "DateTimeOriginal",
  recordDateTimeFormat = "%Y-%m-%d %H:%M:%S",
  sinkpath
)

Arguments

recordTable
data.frame containing a species record database as calculated by recordDatabase
CTtable
data.frame containing information about location and trapping period of camera trap stations
speciesCol
character. name of the column specifying Species ID in CTtable
stationCol
character. name of the column specifying Station ID in CTtable
cameraCol
character. name of the column specifying Camera ID in CTtable
setupCol
character. name of the column containing camera setup dates in CTtable
retrievalCol
character. name of the column containing camera retrieval dates in CTtable
CTDateFormat
character. The format of columns setupCol and retrievalCol in CTtable.
CTHasProblems
logical. Are there periods of camera malfunction specified in CTtable?
recordDateTimeCol
character. The names of the column containing date and time of record in recordTable
recordDateTimeFormat
character. The date/time format of column recordDateTimeCol in recordTable.
sinkpath
character. The directory into which the survey report is saved (optional)

Value

  • An invisible list containing 5 data.frames.
  • survey_datesstation and image date ranges, number of total and active trap nights, number of cameras per station
  • species_by_stationspecies numbers by station
  • events_by_speciesnumber of events and stations by species
  • events_by_stationnumber of events for every species by station (only species that were recorded)
  • events_by_station2number of events for all species at all stations (including species that were not recorded)
  • The output will be saved to a .txt file if sinkpath is defined.

Details

The value of CTDateFormat should be an interpretable by as.Date CTDateFormat defaults to "YYYY-MM-DD", e.g. "2014-10-31". See strptime for how to format date and time strings in R. If CTHasProblems is set to TRUE the function tries to find columns ProblemX_from and ProblemX_to in CTtable (X designates numbers from 1 to n in which a camera or station was not operational). If there are no such columns all stations are assumed to have been operational from setup to retrieval.

See Also

recordDatabase

Examples

Run this code
data(camtraps)
data(recordDatabaseSample)

reportTest <- surveyReport (recordTable          = recordDatabaseSample,
                            CTtable              = camtraps,
                            speciesCol           = "Species",
                            stationCol           = "Station",
                            setupCol             = "Setup_date",
                            retrievalCol         = "Retrieval_date",
                            CTDateFormat         = "%d/%m/%Y", 
                            recordDateTimeCol    = "DateTimeOriginal",
                            recordDateTimeFormat = "%Y-%m-%d %H:%M:%S")

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

reportTest_problem <- surveyReport (recordTable          = recordDatabaseSample,
                                    CTtable              = camtraps,
                                    speciesCol           = "Species",
                                    stationCol           = "Station",
                                    setupCol             = "Setup_date",
                                    retrievalCol         = "Retrieval_date",
                                    CTDateFormat         = "%d/%m/%Y", 
                                    recordDateTimeCol    = "DateTimeOriginal",
                                    recordDateTimeFormat = "%Y-%m-%d %H:%M:%S",
                                    CTHasProblems        = TRUE)

reportTest_problem$survey_dates

# run again with sinkpath defined
reportTest <- surveyReport (recordTable          = recordDatabaseSample,
                            CTtable              = camtraps,
                            speciesCol           = "Species",
                            stationCol           = "Station",
                            setupCol             = "Setup_date",
                            retrievalCol         = "Retrieval_date",
                            CTDateFormat         = "%d/%m/%Y", 
                            recordDateTimeCol    = "DateTimeOriginal",
                            recordDateTimeFormat = "%Y-%m-%d %H:%M:%S",
                            sinkpath             = getwd())

# have a look at the text file
readLines(list.files(getwd(), pattern = ".txt$", full.names = TRUE))

Run the code above in your browser using DataLab