View source: R/bright_dark_period.R
bright_dark_period | R Documentation |
This function finds the brightest or darkest continuous period of a given
timespan and calculates its mean
light level, onset
,
midpoint
, and offset
. Defined as the period with the maximum
or minimum mean light level.
bright_dark_period(
lightVar,
timeVar,
period_type,
timespan,
sampling_int,
loop = FALSE,
as_df = TRUE,
wide = TRUE
)
lightVar |
Numeric vector containing the light data. |
timeVar |
Vector containing the time data. Can be POSIXct or numeric. |
period_type |
String indicating the type of period. Must be "bright" or "dark". |
timespan |
Single string or vector of strings with the timespan(s).
Timespans must be in the format "[numeric] [unit]", with possible units
("seconds","minutes","hours","days"). Units can be abbreviated.
See |
sampling_int |
Numeric. Sampling interval in seconds. |
loop |
Logical. Should the data be looped? Defaults to FALSE. |
as_df |
Logical. Should the output be returned as a data frame? Defaults to TRUE. |
wide |
Logical. Should the output be returned in wide format? Defaults to TRUE. |
Assumes regular 24h light data. Otherwise, results may not be meaningful. Looping the data is recommended for finding the darkest period. Missing light values will be removed by default.
Data frame or matrix with pairs of timespan and calculated values. If wide is TRUE then variable names will be concatenated with the timespan.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.