Learn R Programming

camtrapR (version 0.99.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 recordTable.

Usage

activityRadial(recordTable, 
  species,
  allSpecies = 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 recordTable
species
Name of the species for which to create an kernel density plot of activity
allSpecies
logical. Create plots for all species in speciesCol of recordTable? Overrides argument species
speciesCol
character. name of the column specifying species names in recordTable
recordDateTimeCol
character. name of the column specifying date and time in recordTable
recordDateTimeFormat
character. format of column recordDateTimeCol in recordTable
byNumber
logical. If FALSE, plot proportion of records. If TRUE, plot number of records
plotR
logical. Show plots in R graphics device?
writePNG
logical. Create pngs of the plots?
plotDirectory
character. Directory in which to create png plots if writePNG = TRUE
createDir
logical. Create plotDirectory?
pngMaxPix
integer. image size of png (pixels along x-axis)
...
additional arguments to be passed to function radial.plot

Value

  • 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 table
data(recordTableSample)

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

activityRadial(recordTable       = recordTableSample,
               species           = species4activity,
               allSpecies        = FALSE,
               speciesCol        = "Species",
               recordDateTimeCol = "DateTimeOriginal",
               plotR             = TRUE,
               writePNG          = FALSE,
               lwd               = 5
)

# with polygon
activityRadial(recordTable       = recordTableSample,
               species           = species4activity,
               allSpecies        = FALSE,
               speciesCol        = "Species",
               recordDateTimeCol = "DateTimeOriginal",
               plotR             = TRUE,
               writePNG          = FALSE,
               lwd               = 5,
               rp.type           = "p"
)

Run the code above in your browser using DataLab