Learn R Programming

camtrapR (version 0.97.0)

activityRadial: Radial plots of single-species activity

Description

The function generates a radial plot of species diel activity using an adapted version of function radial.plot from package plotrix (without the need to install the package). Records are aggregated by hour. The number of independent events is used as input, which in turn is based on the argument minDeltaTime in recordDatabase.

Usage

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

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. 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
byNumber
logical. If FALSE, plot proportion of records. If TRUE, plot number of records
plotR
logical. Create plots in R graphics device?
writePNG
logical. Create pngs of the plots?
plotDirectory
character. Path of the pngs
createDir
logical. Create plotDirectory?
pngMaxPix
integer. number of pixels in pngs along x axis
...
additional arguments to be passed to function radial.plot

Value

  • It returns invisibly a data.frame containing all information needed to create the plot: radial position, lengths, hour (for labels). If allSpecies == TRUE, all species' data frames are returned in an invisible named list.

Details

radial.plot was adjusted to show a clockwise 24-hour clock face. It is recommended to set argument lwd to a value >= 2. You may also wish to add argument rp.type="p" to show a polygon instead of bars.

References

Lemon, J. (2006) Plotrix: a package in the red light district of R. R-News, 6(4): 8-12. http://CRAN.R-project.org/package=plotrix

See Also

activityDensity, activityHistogram, activityOverlap

Examples

Run this code
# load record database
data(recordDatabaseSample)

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

activityRadial(recordTable = recordDatabaseSample,
  species = species4activity,
  all.species = FALSE,
  speciesCol = "Species",
  recordDateTimeCol = "DateTimeOriginal",
  plotR = TRUE,
  writePNG = FALSE,
  lwd = 5
)

Run the code above in your browser using DataLab