This function calculates the dose from a time series. For light, this is equal to the actual definition of light exposure (CIE term luminous exposure). Output will always be provided in value·hours (e.g., for light, lx·hours).
Arguments
- Light.vector
Numeric vector containing the light data.
- Time.vector
Vector containing the time data. Can be POSIXct, hms, duration, or difftime.
- epoch
The epoch at which the data was sampled. Can be either a duration or a string. If it is a string, it needs to be either
"dominant.epoch"(the default) for a guess based on the data, or a valid duration string, e.g.,"1 day"or"10 sec".- na.rm
Logical. Should missing values (NA) be removed for the calculation? Defaults to
FALSE.- as.df
Logical. Should a data frame with be returned? If
TRUE, a data frame with a single column nameddosewill be returned. Defaults toFALSE.
Details
The time series does not have to be regular, however, it will be aggregated
to a regular timeseries of the given epoch. Implicit gaps (i.e., no
observations), will be converted to NA values (which can be ignored with
na.rm = TRUE).
References
Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. Lighting Research & Technology. doi:10.1177/14771535231170500
See also
Other metrics:
bright_dark_period(),
centroidLE(),
disparity_index(),
duration_above_threshold(),
exponential_moving_average(),
frequency_crossing_threshold(),
interdaily_stability(),
intradaily_variability(),
midpointCE(),
nvRC(),
nvRD(),
nvRD_cumulative_response(),
period_above_threshold(),
pulses_above_threshold(),
threshold_for_duration(),
timing_above_threshold()
Examples
dose(c(1,1,1,1), lubridate::dhours(c(1:4)), na.rm = TRUE)
#> [1] 4
#with gaps
dose(c(1,1,1), lubridate::dhours(c(1,3:4)), na.rm = TRUE)
#> [1] 3
#gaps can be aggregated to a coarser interval, which can be sensibe
#if they are still representative
dose(c(1,1,1), lubridate::dhours(c(1,3:4)), na.rm = TRUE, epoch = "2 hours")
#> [1] 4
