Frequency of crossing light threshold
Source:R/metric_frequency_crossing_threshold.R
frequency_crossing_threshold.Rd
This functions calculates the number of times a given threshold light level is crossed.
Arguments
- Light.vector
Numeric vector containing the light data.
- threshold
Single numeric value specifying the threshold light level to compare with.
- na.rm
Logical. Should missing light values be removed? Defaults to
FALSE
.- as.df
Logical. Should the output be returned as a data frame? If
TRUE
, a data frame with a single column namedfrequency_crossing_{threshold}
will be returned. Defaults toFALSE
.
References
Alvarez, A. A., & Wildsoet, C. F. (2013). Quantifying light exposure patterns in young adult students. Journal of Modern Optics, 60(14), 1200–1208. doi:10.1080/09500340.2013.845700
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()
,
interdaily_stability()
,
intradaily_variability()
,
midpointCE()
,
nvRC()
,
nvRD()
,
nvRD_cumulative_response()
,
period_above_threshold()
,
pulses_above_threshold()
,
threshold_for_duration()
,
timing_above_threshold()
Examples
N = 60
dataset1 <-
tibble::tibble(
Id = rep("A", N),
Datetime = lubridate::as_datetime(0) + lubridate::minutes(1:N),
MEDI = sample(c(sample(1:249, N / 2), sample(250:1000, N / 2))),
)
dataset1 %>%
dplyr::reframe("Frequency crossing 250lx" = frequency_crossing_threshold(MEDI, threshold = 250))
#> # A tibble: 1 × 1
#> `Frequency crossing 250lx`
#> <int>
#> 1 28
dataset1 %>%
dplyr::reframe(frequency_crossing_threshold(MEDI, threshold = 250, as.df = TRUE))
#> # A tibble: 1 × 1
#> frequency_crossing_250
#> <int>
#> 1 28