Create a report about s camera trapping survey and species detections

Share:

Description

This function creates a report about a camera trapping survey and species records. It uses a camera trap station information table and a record table (generated with recordTable) as input. Output tables can be saved and a zip file for simple data sharing can be created easily.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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",
  Xcol,
  Ycol,
  sinkpath,
  makezip
)

Arguments

recordTable

data.frame containing a species record table as calculated by recordTable

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.

Xcol

character. name of the column specifying x coordinates in CTtable. Used to create detection maps if makezip is TRUE. (optional)

Ycol

character. name of the column specifying y coordinates in CTtable. Used to create detection maps if makezip is TRUE. (optional)

sinkpath

character. The directory into which the survey report is saved (optional)

makezip

logical. Create a zip file containing tables, plots and maps in sinkpath?

Details

The value of CTDateFormat should be 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 uninterruptedly from setup to retrieval.

Value

An invisible list containing 5 data.frames.

survey_dates

station and image date ranges, number of total and active trap nights, number of cameras per station

species_by_station

species numbers by station

events_by_species

number of events and stations by species

events_by_station

number of events for every species by station (only species that were recorded)

events_by_station2

number 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.

If makezip is TRUE, a zip file will be created in sinkpath. It contains single-species activity plots, detection maps (if Xcol and Ycol are defined), the survey report tables, the record table and the camera trap station table, and an example R script.

Author(s)

Juergen Niedballa

See Also

recordTable

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
data(camtraps)
data(recordTableSample)

reportTest <- surveyReport (recordTable          = recordTableSample,
                            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          = recordTableSample,
                                    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

## Not run: 
# run again with sinkpath defined
reportTest <- surveyReport (recordTable          = recordTableSample,
                            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 = paste("survey_report_", Sys.Date(), ".txt", sep = ""), 
					 full.names = TRUE))

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.