View source: R/activityRadial.R
activityRadial | R Documentation |
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,
...
)
recordTable |
data.frame. the record table created by
|
species |
Name of the species for which to create an kernel density plot of activity |
allSpecies |
logical. Create plots for all species in |
speciesCol |
character. name of the column specifying species names in
|
recordDateTimeCol |
character. name of the column specifying date and
time in |
recordDateTimeFormat |
character. format of column
|
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
|
createDir |
logical. Create |
pngMaxPix |
integer. image size of png (pixels along x-axis) |
... |
additional arguments to be passed to function
|
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
.
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.
Juergen Niedballa
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
activityDensity
, activityHistogram
,
activityOverlap
# 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"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.