Learn R Programming

camtrapR (version 0.97.0)

activityDensity: Plot kernel density function of single-species activity

Description

The function plots a kernel density estimation of species diel activity using function densityPlot from package overlap.

Usage

activityDensity(recordTable, 
  species,
  all.species = FALSE,
  speciesCol = "Species",
  recordDateTimeCol = "DateTimeOriginal",
  recordDateTimeFormat = "%Y-%m-%d %H:%M:%S",
  plotR = TRUE, 
  writePNG = FALSE, 
  plotDirectory, 
  createDir = FALSE, 
  pngMaxPix = 1000,
  add.rug = TRUE,
  ...
)

Arguments

recordTable
data.frame. the record table created by recordDatabase
species
Name of the single species for which to create an kernel density plot of activity
all.species
logical. If TRUE, plots are created for all species in recordTable. This overrides argument species
speciesCol
character. name of the column specifying species in recordTable
recordDateTimeCol
character. name of the column specifying date and time in recordTable
recordDateTimeFormat
format of column recordDateTimeCol in recordTable
plotR
logical. Create plots in R graphics device?
writePNG
logical. Create pngs of the plots?
plotDirectory
character. Directory to save the pngs if writePNG = TRUE
createDir
logical. Create plotDirectory if writePNG = TRUE?
pngMaxPix
integer. number of pixels in the png along the x axis
add.rug
logical. add a rug to the plot?
...
additional arguments to be passed to function densityPlot

Value

  • It returns invisibly a vector of species record observation times in radians, ie. scaled to [$0, 2\pi$]. If allSpecies == TRUE, all species' vectors are returned in an invisible named list.

Details

species must be in the speciesCol of recordTable.

References

Martin Ridout and Matthew Linkie (2009). Estimating overlap of daily activity patterns from camera trap data. Journal of Agricultural, Biological and Environmental Statistics, 14(3), 322-337 Mike Meredith and Martin Ridout (2014). overlap: Estimates of coefficient of overlapping for animal activity patterns. R package version 0.2.4. http://CRAN.R-project.org/package=overlap

See Also

http://www.kent.ac.uk/smsas/personal/msr/overlap.html

Examples

Run this code
# load record database
data(recordDatabaseSample)

species4activity <- "VTA"    # = Viverra tangalunga, Malay Civet

activityDensity(recordTable = recordDatabaseSample,
                        species = species4activity)


# all species at once

activityDensity(recordTable = recordDatabaseSample,
                all.species = TRUE,
                writePNG = FALSE,
                plotR = TRUE,
                add.rug = TRUE)

Run the code above in your browser using DataLab