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
.
activityRadial(
recordTable,
species,
allSpecies = FALSE,
speciesCol = "Species",
recordDateTimeCol = "DateTimeOriginal",
recordDateTimeFormat = "ymd HMS",
byNumber = FALSE,
plotR = TRUE,
writePNG = FALSE,
plotDirectory,
createDir = FALSE,
pngMaxPix = 1000,
...
)
data.frame. the record table created by
recordTable
Name of the species for which to create an kernel density plot of activity
logical. Create plots for all species in speciesCol
of recordTable
? Overrides argument species
character. name of the column specifying species names in
recordTable
character. name of the column specifying date and
time in recordTable
character. format of column
recordDateTimeCol
in recordTable
logical. If FALSE, plot proportion of records. If TRUE, plot number of records
logical. Show plots in R graphics device?
logical. Create pngs of the plots?
character. Directory in which to create png plots if
writePNG = TRUE
logical. Create plotDirectory
?
integer. image size of png (pixels along x-axis)
additional arguments to be passed to function
radial.plot
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.
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.
recordDateTimeFormat
defaults to the "YYYY-MM-DD HH:MM:SS"
convention, e.g. "2014-09-30 22:59:59". recordDateTimeFormat
can be
interpreted either by base-R via strptime
or in
lubridate via parse_date_time
(argument
"orders"). lubridate will be used if there are no "%" characters in
recordDateTimeFormat
.
For "YYYY-MM-DD HH:MM:SS", recordDateTimeFormat
would be either
"%Y-%m-%d %H:%M:%S" or "ymd HMS". For details on how to specify date
and time formats in R see strptime
or
parse_date_time
.
Lemon, J. (2006) Plotrix: a package in the red light district of
R. R-News, 6(4): 8-12.
https://CRAN.R-project.org/package=plotrix
# load record table
data(recordTableSample)
species4activity <- "PBE" # = Prionailurus bengalensis, Leopard Cat
activityRadial(recordTable = recordTableSample,
species = species4activity,
allSpecies = FALSE,
speciesCol = "Species",
recordDateTimeCol = "DateTimeOriginal",
plotR = TRUE,
writePNG = FALSE,
lwd = 5
)
# plot type = polygon
activityRadial(recordTable = recordTableSample,
species = species4activity,
allSpecies = FALSE,
speciesCol = "Species",
recordDateTimeCol = "DateTimeOriginal",
plotR = TRUE,
writePNG = FALSE,
lwd = 5,
rp.type = "p"
)