Learn R Programming

LightLogR (version 0.3.8)

disparity_index: Disparity index

Description

This function calculates the continuous disparity index as described in Fernández-Martínez et al. (2018).

Usage

disparity_index(Light.vector, na.rm = FALSE, as.df = FALSE)

Value

Single column data frame or vector.

Arguments

Light.vector

Numeric vector containing the light data.

na.rm

Logical. Should missing 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 named disparity_index will be returned. Defaults to FALSE.

References

Fernández-Martínez, M., Vicca, S., Janssens, I. A., Carnicer, J., Martín-Vide, J., & Peñuelas, J. (2018). The consecutive disparity index, D: A measure of temporal variability in ecological studies. Ecosphere, 9(12), e02527. tools:::Rd_expr_doi("10.1002/ecs2.2527")

Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. Lighting Research & Technology. tools:::Rd_expr_doi("10.1177/14771535231170500")

See Also

Other metrics: bright_dark_period(), centroidLE(), 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

Run this code
dataset1 <-
  tibble::tibble(
    Id = rep("A", 24),
    Datetime = lubridate::as_datetime(0) + lubridate::hours(0:23),
    MEDI = sample(0:1000, 24),
  )
dataset1 %>%
  dplyr::reframe(
    "Disparity index" = disparity_index(MEDI)
  )

Run the code above in your browser using DataLab