From d29b24f962293ca18db6fbf0dee21ab31e14ca09 Mon Sep 17 00:00:00 2001 From: Johannes Zauner <112665672+JZauner@users.noreply.github.com> Date: Wed, 3 Jul 2024 19:37:20 +0200 Subject: [PATCH] preparation for CRAN submission --- .Rbuildignore | 1 + DESCRIPTION | 5 +- R/metric_EMA.R | 4 +- R/metric_barroso.R | 4 +- R/metric_bright_dark_period.R | 2 +- R/metric_centroidLE.R | 4 +- R/metric_disparity_index.R | 4 +- R/metric_duration_above_threshold.R | 2 +- R/metric_frequency_crossing_threshold.R | 4 +- R/metric_interdaily_stability.R | 4 +- R/metric_intradaily_variability.R | 4 +- R/metric_midpointCE.R | 4 +- R/metric_nvR.R | 138 ++---------------------- R/metric_pulses_above_threshold.R | 2 +- R/metric_timing_above_threshold.R | 4 +- cran-comments.md | 14 +++ man/LightLogR-package.Rd | 2 +- man/barroso_lighting_metrics.Rd | 4 +- man/bright_dark_period.Rd | 2 +- man/centroidLE.Rd | 4 +- man/disparity_index.Rd | 4 +- man/duration_above_threshold.Rd | 2 +- man/exponential_moving_average.Rd | 4 +- man/frequency_crossing_threshold.Rd | 4 +- man/interdaily_stability.Rd | 4 +- man/intradaily_variability.Rd | 4 +- man/midpointCE.Rd | 4 +- man/nvRC.Rd | 70 +----------- man/nvRC_metrics.Rd | 6 +- man/nvRD.Rd | 61 +---------- man/nvRD_cumulative_response.Rd | 2 +- man/pulses_above_threshold.Rd | 2 +- man/timing_above_threshold.Rd | 4 +- 33 files changed, 80 insertions(+), 303 deletions(-) mode change 100755 => 100644 man/bright_dark_period.Rd mode change 100755 => 100644 man/interdaily_stability.Rd mode change 100755 => 100644 man/intradaily_variability.Rd mode change 100755 => 100644 man/timing_above_threshold.Rd diff --git a/.Rbuildignore b/.Rbuildignore index d9dd617..b60119f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -15,3 +15,4 @@ ^vignettes/articles$ ^\.gitlab-ci\.yml$ ^cran-comments\.md$ +^LightLogR-manual\.tex$ \ No newline at end of file diff --git a/DESCRIPTION b/DESCRIPTION index 8768bcf..f77a94d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,11 +15,11 @@ Authors@R: c( person("EURAMET", role = "fnd", comment = "European Association of National Metrology Institutes. Website: www.euramet.org. Grant Number: 22NRM05 MeLiDos. Grant Statement: The project (22NRM05 MeLiDos) has received funding from the European Partnership on Metrology, co-financed from the European Union’s Horizon Europe Research and Innovation Programme and by the Participating States."), person("European Union", role = "fnd", comment = "Co-funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or EURAMET. Neither the European Union nor the granting authority can be held responsible for them."), person("TSCN-Lab", comment = c(URL = "www.tscnlab.org"), role = "cph")) -Description: LightLogR facilitates easy import, processing, validation, and visualization of personal light exposure measurement data from wearable devices. The package implements features such as the import of data and metadata files, conversion of common file formats, validation of light logging data, verification of crucial metadata, calculation of common parameters, and semi-automated analysis and visualization. +Description: Import, processing, validation, and visualization of personal light exposure measurement data from wearable devices. The package implements features such as the import of data and metadata files, conversion of common file formats, validation of light logging data, verification of crucial metadata, calculation of common parameters, and semi-automated analysis and visualization. License: GPL (>= 3) Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 URL: https://github.com/tscnlab/LightLogR, https://tscnlab.github.io/LightLogR/, https://zenodo.org/doi/10.5281/zenodo.11562600 @@ -61,4 +61,3 @@ Suggests: testthat (>= 3.0.0), tidyverse Config/testthat/edition: 3 -VignetteBuilder: knitr diff --git a/R/metric_EMA.R b/R/metric_EMA.R index 5889c47..ea1935f 100644 --- a/R/metric_EMA.R +++ b/R/metric_EMA.R @@ -30,11 +30,11 @@ #' @references #' Price, L. L. A. (2014). On the Role of Exponential Smoothing in Circadian #' Dosimetry. \emph{Photochemistry and Photobiology}, 90(5), 1184-1192. -#' \url{https://doi.org/10.1111/php.12282} +#' \doi{10.1111/php.12282} #' #' Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: #' Quantification metrics. \emph{Lighting Research & Technology}. -#' \url{https://doi.org/10.1177/14771535231170500} +#' \doi{10.1177/14771535231170500} #' #' @examples #' sample.data.environment.EMA = sample.data.environment %>% diff --git a/R/metric_barroso.R b/R/metric_barroso.R index 12e7743..e625a1b 100644 --- a/R/metric_barroso.R +++ b/R/metric_barroso.R @@ -48,11 +48,11 @@ #' @references #' Barroso, A., Simons, K., & Jager, P. de. (2014). Metrics of circadian #' lighting for clinical investigations. \emph{Lighting Research & Technology}, -#' 46(6), 637–649. \url{https://doi.org/10.1177/1477153513502664} +#' 46(6), 637–649. \doi{10.1177/1477153513502664} #' #' Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: #' Quantification metrics. \emph{Lighting Research & Technology}. -#' \url{https://doi.org/10.1177/14771535231170500} +#' \doi{10.1177/14771535231170500} #' #' @examples #' diff --git a/R/metric_bright_dark_period.R b/R/metric_bright_dark_period.R index ffb481d..2544924 100755 --- a/R/metric_bright_dark_period.R +++ b/R/metric_bright_dark_period.R @@ -38,7 +38,7 @@ #' @references #' Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: #' Quantification metrics. \emph{Lighting Research & Technology}. -#' \url{https://doi.org/10.1177/14771535231170500} +#' \doi{10.1177/14771535231170500} #' #' @export #' diff --git a/R/metric_centroidLE.R b/R/metric_centroidLE.R index 3212e39..523f443 100755 --- a/R/metric_centroidLE.R +++ b/R/metric_centroidLE.R @@ -25,11 +25,11 @@ #' L. K., Picard, R. W., Lockley, S. W., Klerman, E. B., & Czeisler, C. A. (2017). #' Irregular sleep/wake patterns are associated with poorer academic performance #' and delayed circadian and sleep/wake timing. \emph{Scientific Reports}, -#' 7(1), 3216. \url{https://doi.org/10.1038/s41598-017-03171-4} +#' 7(1), 3216. \doi{10.1038/s41598-017-03171-4} #' #' Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: #' Quantification metrics. \emph{Lighting Research & Technology}. -#' \url{https://doi.org/10.1177/14771535231170500} +#' \doi{10.1177/14771535231170500} #' #' @examples #' # Dataset with POSIXct time vector diff --git a/R/metric_disparity_index.R b/R/metric_disparity_index.R index 79d06f3..9b5e60d 100644 --- a/R/metric_disparity_index.R +++ b/R/metric_disparity_index.R @@ -20,11 +20,11 @@ #' Martín-Vide, J., & Peñuelas, J. (2018). #' The consecutive disparity index, D: A measure of temporal variability in #' ecological studies. \emph{Ecosphere}, 9(12), e02527. -#' \url{https://doi.org/10.1002/ecs2.2527} +#' \doi{10.1002/ecs2.2527} #' #' Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: #' Quantification metrics. \emph{Lighting Research & Technology}. -#' \url{https://doi.org/10.1177/14771535231170500} +#' \doi{10.1177/14771535231170500} #' #' @examples #' dataset1 <- diff --git a/R/metric_duration_above_threshold.R b/R/metric_duration_above_threshold.R index 63fba2f..64b1bf6 100755 --- a/R/metric_duration_above_threshold.R +++ b/R/metric_duration_above_threshold.R @@ -27,7 +27,7 @@ #' @references #' Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: #' Quantification metrics. \emph{Lighting Research & Technology}. -#' \url{https://doi.org/10.1177/14771535231170500} +#' \doi{10.1177/14771535231170500} #' #' @export #' diff --git a/R/metric_frequency_crossing_threshold.R b/R/metric_frequency_crossing_threshold.R index 14f1d03..a2879e1 100644 --- a/R/metric_frequency_crossing_threshold.R +++ b/R/metric_frequency_crossing_threshold.R @@ -19,11 +19,11 @@ #' @references #' Alvarez, A. A., & Wildsoet, C. F. (2013). Quantifying light #' exposure patterns in young adult students. \emph{Journal of Modern Optics}, -#' 60(14), 1200–1208. \url{https://doi.org/10.1080/09500340.2013.845700} +#' 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. \emph{Lighting Research & Technology}. -#' \url{https://doi.org/10.1177/14771535231170500} +#' \doi{10.1177/14771535231170500} #' #' @examples # diff --git a/R/metric_interdaily_stability.R b/R/metric_interdaily_stability.R index 8076256..38a18fa 100755 --- a/R/metric_interdaily_stability.R +++ b/R/metric_interdaily_stability.R @@ -24,11 +24,11 @@ #' McCall, W. V., & Rosenquist, P. B. (1999). Bright Light Therapy: Improved #' Sensitivity to Its Effects on Rest-Activity Rhythms in Alzheimer Patients #' by Application of Nonparametric Methods. \emph{Chronobiology International}, -#' 16(4), 505–518. \url{https://doi.org/10.3109/07420529908998724} +#' 16(4), 505–518. \doi{10.3109/07420529908998724} #' #' Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: #' Quantification metrics. \emph{Lighting Research & Technology}. -#' \url{https://doi.org/10.1177/14771535231170500} +#' \doi{10.1177/14771535231170500} #' #' @examples #' diff --git a/R/metric_intradaily_variability.R b/R/metric_intradaily_variability.R index 7aab154..5b8d9b3 100755 --- a/R/metric_intradaily_variability.R +++ b/R/metric_intradaily_variability.R @@ -22,11 +22,11 @@ #' McCall, W. V., & Rosenquist, P. B. (1999). Bright Light Therapy: Improved #' Sensitivity to Its Effects on Rest-Activity Rhythms in Alzheimer Patients #' by Application of Nonparametric Methods. \emph{Chronobiology International}, -#' 16(4), 505–518. \url{https://doi.org/10.3109/07420529908998724} +#' 16(4), 505–518. \doi{10.3109/07420529908998724} #' #' Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: #' Quantification metrics. \emph{Lighting Research & Technology}. -#' \url{https://doi.org/10.1177/14771535231170500} +#' \doi{10.1177/14771535231170500} #' #' @examples #' diff --git a/R/metric_midpointCE.R b/R/metric_midpointCE.R index 03a1904..5037ce1 100644 --- a/R/metric_midpointCE.R +++ b/R/metric_midpointCE.R @@ -22,11 +22,11 @@ #' Shochat, T., Santhi, N., Herer, P., Flavell, S. A., Skeldon, A. C., #' & Dijk, D.-J. (2019). Sleep Timing in Late Autumn and Late Spring Associates #' With Light Exposure Rather Than Sun Time in College Students. -#' \emph{Frontiers in Neuroscience}, 13. \url{https://doi.org/10.3389/fnins.2019.00882} +#' \emph{Frontiers in Neuroscience}, 13. \doi{10.3389/fnins.2019.00882} #' #' Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: #' Quantification metrics. \emph{Lighting Research & Technology}. -#' \url{https://doi.org/10.1177/14771535231170500} +#' \doi{10.1177/14771535231170500} #' #' @examples # Dataset with POSIXct time vector diff --git a/R/metric_nvR.R b/R/metric_nvR.R index 0796fb8..94da0e6 100644 --- a/R/metric_nvR.R +++ b/R/metric_nvR.R @@ -10,12 +10,12 @@ #' #' @param MEDI.vector Numeric vector containing the melanopic EDI data. #' @param Illuminance.vector Numeric vector containing the Illuminance data. -#' @param Time.vector Vector containing the time data. Can be \link[base]{POSIXct}, \link[hms]{hms}, -#' \link[lubridate]{duration}, or \link[base]{difftime}. +#' @param Time.vector Vector containing the time data. Can be [POSIXct()],[hms::hms()], +#' [lubridate::duration()], [difftime()]. #' @param epoch The epoch at which the data was sampled. Can be either a -#' \link[lubridate]{duration} or a string. If it is a string, it needs to be +#' [lubridate::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 -#' \link[lubridate]{duration} string, e.g., `"1 day"` or `"10 sec"`. +#' [lubridate::duration()] string, e.g., `"1 day"` or `"10 sec"`. #' #' @return A numeric vector containing the nvRD data. The output has the same #' length as `Time.vector`. @@ -25,62 +25,11 @@ #' #' @details The timeseries is assumed to be regular. Missing values in the #' light data will be replaced by 0. -#' -#' The inputs to the model are discrete time samples of melanopic equivalent -#' daylight (D65) illuminance (mEDI) \eqn{E_{v,mel}^{D65}(t)}, transformed into -#' the effective light stimulus \eqn{I(t)}. -#' -#' \deqn{I(t) = E_{v,mel}^{D65} * K_{mel,v}^{D65}/A_{mel},} -#' -#' where \eqn{K_{mel,v}^{D65} = 1.3262 / 1000} is the melanopic normalization factor -#' to convert melanopic EDI to melanopic Irradiance and \eqn{A_{mel} = 97.07} is the -#' area of the melanopic sensitivity curve. -#' -#' The light stimulus \eqn{I(t)} is then passed through a linear filter \eqn{L1}, -#' which is associated with the temporal integration of the retina, to determine the -#' output \eqn{u(t)}. -#' -#' \deqn{u(t) = \frac{1}{d_{1}}\sum_{i=0}^{d_{1}/\Delta t} I(t-1)\Delta t,} -#' -#' where \eqn{d_{1}} is the length of filter \eqn{L1}. The time step size -#' \eqn{\Delta t} is the epoch at which the data was sampled. -#' Then \eqn{u(t)} is transformed by a nonlinear function \eqn{N(u)}, describing the -#' intensity-response relationship to the light stimulus, to determine the -#' output \eqn{v(t)}. -#' -#' \deqn{v(t) = N(u(t)) = \frac{1}{1+(\sigma(t)/u(t))^n}.} -#' -#' The half-maximum constant \eqn{\sigma} adapts to prior light history -#' \deqn{ -#' \begin{array}{ll} -#' \sigma(t)=\sigma_{0}/2, & \qquad & \forall u_{H}(t)<0,\\ -#' \sigma(t)=\sigma_{0}\times2^{u_{H}(t)-1}, & \qquad & \forall u_{H}(t)\geq 0. -#' \end{array} -#' } -#' -#' The prior history of light exposure is calculated using a moving window, -#' filter \eqn{LH}, to average the input -#' -#' \deqn{u_{H}(t) = \frac{1}{d_{H}}\sum_{i=0}^{d_{H}/\Delta t} -#' \log_{10}(E_{v}(t-i))\Delta t,} -#' -#' where \eqn{dH} is the width of the filter \eqn{LH} in hours and \eqn{E_{v}} -#' is the photopic illuminance. -#' -#' The signal \eqn{v(t)} is finally passed through a second filter \eqn{L2}, -#' which reflects the adaptation of the non-visual system to continuous light -#' exposure, to determine the final output \eqn{r_{D}(t)}. -#' -#' \deqn{r_{D}(t)=\alpha \times v(t−1)+(1−\alpha) \times r_{D}(t−1),} -#' -#' where \eqn{\alpha=2/(d2/\Delta t+1)} and \eqn{d2} is the length of filter -#' \eqn{L2} in hours. The model outputs are time-sampled relative non-visual -#' responses. #' #' @references Amundadottir, M.L. (2016). Light-driven model for identifying #' indicators of non-visual health potential in the built environment #' \[Doctoral dissertation, EPFL\]. EPFL infoscience. -#' \url{http://dx.doi.org/10.5075/epfl-thesis-7146} +#' \doi{10.5075/epfl-thesis-7146} #' #' @examples #' @@ -201,7 +150,7 @@ nvRD <- function(MEDI.vector, #' @references Amundadottir, M.L. (2016). Light-driven model for identifying #' indicators of non-visual health potential in the built environment #' \[Doctoral dissertation, EPFL\]. EPFL infoscience. -#' \url{http://dx.doi.org/10.5075/epfl-thesis-7146} +#' \doi{10.5075/epfl-thesis-7146} #' #' @examples #' dataset1 <- @@ -288,78 +237,11 @@ nvRD_cumulative_response <- function(nvRD, #' @details The timeseries is assumed to be regular. Missing values in the #' light data will be replaced by 0. #' -#' The inputs to the model are discrete time samples of melanopic equivalent -#' daylight (D65) illuminance (mEDI) \eqn{E_{v,mel}^{D65}(t)}, transformed into -#' the effective light stimulus \eqn{I(t)}. -#' -#' \deqn{I(t) = E_{v,mel}^{D65} * K_{mel,v}^{D65}/A_{mel},} -#' -#' where \eqn{K_{mel,v}^{D65} = 1.3262 / 1000} is the melanopic normalization factor -#' to convert melanopic EDI to melanopic Irradiance and \eqn{A_{mel} = 97.07} is the -#' area of the melanopic sensitivity curve. -#' -#' The light stimulus \eqn{I(t)} is then passed through a linear filter \eqn{L1}, -#' which is associated with the temporal integration of the retina, to determine the -#' output \eqn{u(t)}. -#' -#' \deqn{u(t) = \frac{1}{d_{1}} \sum_{i=0}^{d_{1}/\Delta t} I(t-1)\Delta t,} -#' -#' where \eqn{d_{1}} is the length of filter \eqn{L1}. The time step size -#' \eqn{\Delta t} is the epoch at which the data was sampled. -#' Then \eqn{u(t)} is transformed by a nonlinear function \eqn{N(u)}, describing the -#' intensity-response relationship to the light stimulus, to determine the -#' output \eqn{v(t)}. -#' -#' \deqn{v(t) = N(u(t)) \times N_{C}(t) = \frac{N_{C}(t)}{1+(\sigma(t)/u(t))^n}.} -#' -#' The saturation intensity is controlled by the circadian sensitivity modulator -#' -#' \deqn{N_{C}(t)=(1−0.4C_{1}(t))(1−0.4C_{2}(t)),} -#' -#' acting as a simple harmonic oscillator -#' -#' \deqn{ -#' \begin{array}{l} -#' C_{1} = \cos(\pi(t/12+1)+\phi_{xcx}/2),\\ -#' C_{2} = -\sin(\pi(t/12+1)+\phi_{xcx}/2), -#' \end{array} -#' } -#' -#' where the phase angle to CBT min \eqn{\phi_{xcx}} is equal to \eqn{-2.98} rad, -#' assuming that sleep onset is at \eqn{t_{0}}. -#' -#' The half-maximum constant \eqn{\sigma} adapts to prior light history -#' -#' \deqn{ -#' \begin{array}{ll} -#' \sigma(t)=\sigma_{0}/2, & \qquad & \forall u_{H}(t)<0,\\ -#' \sigma(t)=\sigma_{0}\times2^{u_{H}(t)-1}, & \qquad & \forall u_{H}(t)\geq 0. -#' \end{array} -#' } -#' -#' The prior history of light exposure is calculated using a moving window, -#' filter \eqn{LH}, to average the input -#' -#' \deqn{u_{H}(t) = \frac{1}{d_{H}}\sum_{i=0}^{d_{H}/\Delta t} -#' \log_{10}(E_{v}(t-i))\Delta t,} -#' -#' where \eqn{dH} is the width of the filter \eqn{LH} in hours and \eqn{E_{v}} -#' is the photopic illuminance. -#' -#' The signal \eqn{v(t)} is finally passed through a second filter \eqn{L2}, -#' which reflects the adaptation of the non-visual system to continuous light -#' exposure, to determine the final output \eqn{r_{C}(t)}. -#' -#' \deqn{r_{C}(t)=\alpha \times v(t−1)+(1−\alpha) \times r_{C}(t−1),} -#' -#' where \eqn{\alpha=2/(d2/\Delta t+1)} and \eqn{d2} is the length of filter -#' \eqn{L2} in hours. The model outputs are time-sampled relative non-visual -#' responses. #' #' @references Amundadottir, M.L. (2016). Light-driven model for identifying #' indicators of non-visual health potential in the built environment #' \[Doctoral dissertation, EPFL\]. EPFL infoscience. -#' \url{http://dx.doi.org/10.5075/epfl-thesis-7146} +#' \doi{10.5075/epfl-thesis-7146} #' #' @examples #' @@ -504,7 +386,7 @@ nvRC <- function(MEDI.vector, #' @references Amundadottir, M.L. (2016). Light-driven model for identifying #' indicators of non-visual health potential in the built environment #' \[Doctoral dissertation, EPFL\]. EPFL infoscience. -#' \url{http://dx.doi.org/10.5075/epfl-thesis-7146} +#' \doi{10.5075/epfl-thesis-7146} #' #' @name nvRC_metrics #' @examples @@ -540,7 +422,7 @@ nvRC <- function(MEDI.vector, #' # Relative amplitude error #' nvRC_relativeAmplitudeError(dataset1$nvRC, dataset.reference$nvRC) -NULL + #' @rdname nvRC_metrics #' @@ -623,7 +505,7 @@ nvRC_circadianBias <- function(nvRC, #' `nvRC_relativeAmplitudeError()` calculates the relative amplitude error (RAE). #' It is expressed as #' -#' \deqn{RAE(i,T)=r_{C,max}−r_{C,max}^{ref},} +#' \deqn{RAE(i,T)=r_{C,max}-r_{C,max}^{ref},} #' #' and quantifies the difference between the maximum response achieved in a period #' to the reference signal. diff --git a/R/metric_pulses_above_threshold.R b/R/metric_pulses_above_threshold.R index 6cb8dca..b2142d5 100644 --- a/R/metric_pulses_above_threshold.R +++ b/R/metric_pulses_above_threshold.R @@ -54,7 +54,7 @@ #' @references Wilson, J., Reid, K. J., Braun, R. I., Abbott, S. M., & Zee, P. C. #' (2018). Habitual light exposure relative to circadian timing in delayed #' sleep-wake phase disorder. \emph{Sleep}, 41(11). -#' \url{https://doi.org/10.1093/sleep/zsy166} +#' \doi{10.1093/sleep/zsy166} #' #' @examples #' # Sample data diff --git a/R/metric_timing_above_threshold.R b/R/metric_timing_above_threshold.R index 9d1b72e..b309b7e 100755 --- a/R/metric_timing_above_threshold.R +++ b/R/metric_timing_above_threshold.R @@ -33,11 +33,11 @@ #' Reid, K. J., Santostasi, G., Baron, K. G., Wilson, J., Kang, J., #' & Zee, P. C. (2014). Timing and Intensity of Light Correlate with Body Weight #' in Adults. \emph{PLOS ONE}, 9(4), e92251. -#' \url{https://doi.org/10.1371/journal.pone.0092251} +#' \doi{10.1371/journal.pone.0092251} #' #' Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: #' Quantification metrics. \emph{Lighting Research & Technology}. -#' \url{https://doi.org/10.1177/14771535231170500} +#' \doi{10.1177/14771535231170500} #' #' @examples #' # Dataset with light > 250lx between 06:00 and 18:00 diff --git a/cran-comments.md b/cran-comments.md index 858617d..0510326 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -3,3 +3,17 @@ 0 errors | 0 warnings | 1 note * This is a new release. + +## Windevel results + +Maintainer: 'Johannes Zauner ' + +* New submission + +* Found the following (possibly) invalid URLs: + URL: https://lists.lrz.de/mailman/listinfo/lightlogr-users + From: README.md + Status: 403 + Message: Forbidden + +This URL is valid, but the server does not allow the Windevel server to access it. The URL leads to the mailing list for the package. \ No newline at end of file diff --git a/man/LightLogR-package.Rd b/man/LightLogR-package.Rd index 4da9167..c897403 100644 --- a/man/LightLogR-package.Rd +++ b/man/LightLogR-package.Rd @@ -8,7 +8,7 @@ \description{ \if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} -LightLogR helps to import, process, validate, and visualize personal light exposure measurement data from wearable devices. The package implements features such as the import of data and metadata files, conversion of common file formats, validation of light logging data, verification of crucial metadata, calculation of common parameters, and semi-automated analysis and visualization. +Import, processing, validation, and visualization of personal light exposure measurement data from wearable devices. The package implements features such as the import of data and metadata files, conversion of common file formats, validation of light logging data, verification of crucial metadata, calculation of common parameters, and semi-automated analysis and visualization. } \seealso{ Useful links: diff --git a/man/barroso_lighting_metrics.Rd b/man/barroso_lighting_metrics.Rd index e5beb58..4fb9009 100644 --- a/man/barroso_lighting_metrics.Rd +++ b/man/barroso_lighting_metrics.Rd @@ -80,9 +80,9 @@ dataset1 \%>\% \references{ Barroso, A., Simons, K., & Jager, P. de. (2014). Metrics of circadian lighting for clinical investigations. \emph{Lighting Research & Technology}, -46(6), 637–649. \url{https://doi.org/10.1177/1477153513502664} +46(6), 637–649. \doi{10.1177/1477153513502664} Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. \emph{Lighting Research & Technology}. -\url{https://doi.org/10.1177/14771535231170500} +\doi{10.1177/14771535231170500} } diff --git a/man/bright_dark_period.Rd b/man/bright_dark_period.Rd old mode 100755 new mode 100644 index 17808cf..b90df5f --- a/man/bright_dark_period.Rd +++ b/man/bright_dark_period.Rd @@ -96,7 +96,7 @@ dataset2 \%>\% \references{ Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. \emph{Lighting Research & Technology}. -\url{https://doi.org/10.1177/14771535231170500} +\doi{10.1177/14771535231170500} } \seealso{ Other metrics: diff --git a/man/centroidLE.Rd b/man/centroidLE.Rd index d4e15e2..e93ba71 100644 --- a/man/centroidLE.Rd +++ b/man/centroidLE.Rd @@ -79,11 +79,11 @@ Phillips, A. J. K., Clerx, W. M., O’Brien, C. S., Sano, A., Barger, L. K., Picard, R. W., Lockley, S. W., Klerman, E. B., & Czeisler, C. A. (2017). Irregular sleep/wake patterns are associated with poorer academic performance and delayed circadian and sleep/wake timing. \emph{Scientific Reports}, -7(1), 3216. \url{https://doi.org/10.1038/s41598-017-03171-4} +7(1), 3216. \doi{10.1038/s41598-017-03171-4} Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. \emph{Lighting Research & Technology}. -\url{https://doi.org/10.1177/14771535231170500} +\doi{10.1177/14771535231170500} } \seealso{ Other metrics: diff --git a/man/disparity_index.Rd b/man/disparity_index.Rd index 70297e5..40d1e88 100644 --- a/man/disparity_index.Rd +++ b/man/disparity_index.Rd @@ -40,11 +40,11 @@ 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. \emph{Ecosphere}, 9(12), e02527. -\url{https://doi.org/10.1002/ecs2.2527} +\doi{10.1002/ecs2.2527} Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. \emph{Lighting Research & Technology}. -\url{https://doi.org/10.1177/14771535231170500} +\doi{10.1177/14771535231170500} } \seealso{ Other metrics: diff --git a/man/duration_above_threshold.Rd b/man/duration_above_threshold.Rd index 66a9315..b22a1b9 100644 --- a/man/duration_above_threshold.Rd +++ b/man/duration_above_threshold.Rd @@ -80,7 +80,7 @@ dataset.combined \%>\% \references{ Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. \emph{Lighting Research & Technology}. -\url{https://doi.org/10.1177/14771535231170500} +\doi{10.1177/14771535231170500} } \seealso{ Other metrics: diff --git a/man/exponential_moving_average.Rd b/man/exponential_moving_average.Rd index f15e305..9ca8b97 100644 --- a/man/exponential_moving_average.Rd +++ b/man/exponential_moving_average.Rd @@ -57,11 +57,11 @@ sample.data.environment.EMA \%>\% \references{ Price, L. L. A. (2014). On the Role of Exponential Smoothing in Circadian Dosimetry. \emph{Photochemistry and Photobiology}, 90(5), 1184-1192. -\url{https://doi.org/10.1111/php.12282} +\doi{10.1111/php.12282} Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. \emph{Lighting Research & Technology}. -\url{https://doi.org/10.1177/14771535231170500} +\doi{10.1177/14771535231170500} } \seealso{ Other metrics: diff --git a/man/frequency_crossing_threshold.Rd b/man/frequency_crossing_threshold.Rd index 44c927f..cf0559f 100644 --- a/man/frequency_crossing_threshold.Rd +++ b/man/frequency_crossing_threshold.Rd @@ -48,11 +48,11 @@ dataset1 \%>\% \references{ Alvarez, A. A., & Wildsoet, C. F. (2013). Quantifying light exposure patterns in young adult students. \emph{Journal of Modern Optics}, -60(14), 1200–1208. \url{https://doi.org/10.1080/09500340.2013.845700} +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. \emph{Lighting Research & Technology}. -\url{https://doi.org/10.1177/14771535231170500} +\doi{10.1177/14771535231170500} } \seealso{ Other metrics: diff --git a/man/interdaily_stability.Rd b/man/interdaily_stability.Rd old mode 100755 new mode 100644 index 8c50fd3..a75d623 --- a/man/interdaily_stability.Rd +++ b/man/interdaily_stability.Rd @@ -56,11 +56,11 @@ Van Someren, E. J. W., Swaab, D. F., Colenda, C. C., Cohen, W., McCall, W. V., & Rosenquist, P. B. (1999). Bright Light Therapy: Improved Sensitivity to Its Effects on Rest-Activity Rhythms in Alzheimer Patients by Application of Nonparametric Methods. \emph{Chronobiology International}, -16(4), 505–518. \url{https://doi.org/10.3109/07420529908998724} +16(4), 505–518. \doi{10.3109/07420529908998724} Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. \emph{Lighting Research & Technology}. -\url{https://doi.org/10.1177/14771535231170500} +\doi{10.1177/14771535231170500} } \seealso{ Other metrics: diff --git a/man/intradaily_variability.Rd b/man/intradaily_variability.Rd old mode 100755 new mode 100644 index 87dbb43..0dca74a --- a/man/intradaily_variability.Rd +++ b/man/intradaily_variability.Rd @@ -53,11 +53,11 @@ Van Someren, E. J. W., Swaab, D. F., Colenda, C. C., Cohen, W., McCall, W. V., & Rosenquist, P. B. (1999). Bright Light Therapy: Improved Sensitivity to Its Effects on Rest-Activity Rhythms in Alzheimer Patients by Application of Nonparametric Methods. \emph{Chronobiology International}, -16(4), 505–518. \url{https://doi.org/10.3109/07420529908998724} +16(4), 505–518. \doi{10.3109/07420529908998724} Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. \emph{Lighting Research & Technology}. -\url{https://doi.org/10.1177/14771535231170500} +\doi{10.1177/14771535231170500} } \seealso{ Other metrics: diff --git a/man/midpointCE.Rd b/man/midpointCE.Rd index 7344af1..abd236c 100644 --- a/man/midpointCE.Rd +++ b/man/midpointCE.Rd @@ -67,11 +67,11 @@ dataset3 \%>\% Shochat, T., Santhi, N., Herer, P., Flavell, S. A., Skeldon, A. C., & Dijk, D.-J. (2019). Sleep Timing in Late Autumn and Late Spring Associates With Light Exposure Rather Than Sun Time in College Students. -\emph{Frontiers in Neuroscience}, 13. \url{https://doi.org/10.3389/fnins.2019.00882} +\emph{Frontiers in Neuroscience}, 13. \doi{10.3389/fnins.2019.00882} Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. \emph{Lighting Research & Technology}. -\url{https://doi.org/10.1177/14771535231170500} +\doi{10.1177/14771535231170500} } \seealso{ Other metrics: diff --git a/man/nvRC.Rd b/man/nvRC.Rd index d1db526..97ed48a 100644 --- a/man/nvRC.Rd +++ b/man/nvRC.Rd @@ -43,74 +43,6 @@ input to the non-visual system (see Details). \details{ The timeseries is assumed to be regular. Missing values in the light data will be replaced by 0. - -The inputs to the model are discrete time samples of melanopic equivalent -daylight (D65) illuminance (mEDI) \eqn{E_{v,mel}^{D65}(t)}, transformed into -the effective light stimulus \eqn{I(t)}. - -\deqn{I(t) = E_{v,mel}^{D65} * K_{mel,v}^{D65}/A_{mel},} - -where \eqn{K_{mel,v}^{D65} = 1.3262 / 1000} is the melanopic normalization factor -to convert melanopic EDI to melanopic Irradiance and \eqn{A_{mel} = 97.07} is the -area of the melanopic sensitivity curve. - -The light stimulus \eqn{I(t)} is then passed through a linear filter \eqn{L1}, -which is associated with the temporal integration of the retina, to determine the -output \eqn{u(t)}. - -\deqn{u(t) = \frac{1}{d_{1}} \sum_{i=0}^{d_{1}/\Delta t} I(t-1)\Delta t,} - -where \eqn{d_{1}} is the length of filter \eqn{L1}. The time step size -\eqn{\Delta t} is the epoch at which the data was sampled. -Then \eqn{u(t)} is transformed by a nonlinear function \eqn{N(u)}, describing the -intensity-response relationship to the light stimulus, to determine the -output \eqn{v(t)}. - -\deqn{v(t) = N(u(t)) \times N_{C}(t) = \frac{N_{C}(t)}{1+(\sigma(t)/u(t))^n}.} - -The saturation intensity is controlled by the circadian sensitivity modulator - -\deqn{N_{C}(t)=(1−0.4C_{1}(t))(1−0.4C_{2}(t)),} - -acting as a simple harmonic oscillator - -\deqn{ - \begin{array}{l} - C_{1} = \cos(\pi(t/12+1)+\phi_{xcx}/2),\\ - C_{2} = -\sin(\pi(t/12+1)+\phi_{xcx}/2), - \end{array} - } - -where the phase angle to CBT min \eqn{\phi_{xcx}} is equal to \eqn{-2.98} rad, -assuming that sleep onset is at \eqn{t_{0}}. - -The half-maximum constant \eqn{\sigma} adapts to prior light history - -\deqn{ - \begin{array}{ll} - \sigma(t)=\sigma_{0}/2, & \qquad & \forall u_{H}(t)<0,\\ - \sigma(t)=\sigma_{0}\times2^{u_{H}(t)-1}, & \qquad & \forall u_{H}(t)\geq 0. - \end{array} - } - -The prior history of light exposure is calculated using a moving window, -filter \eqn{LH}, to average the input - -\deqn{u_{H}(t) = \frac{1}{d_{H}}\sum_{i=0}^{d_{H}/\Delta t} - \log_{10}(E_{v}(t-i))\Delta t,} - -where \eqn{dH} is the width of the filter \eqn{LH} in hours and \eqn{E_{v}} -is the photopic illuminance. - -The signal \eqn{v(t)} is finally passed through a second filter \eqn{L2}, -which reflects the adaptation of the non-visual system to continuous light -exposure, to determine the final output \eqn{r_{C}(t)}. - -\deqn{r_{C}(t)=\alpha \times v(t−1)+(1−\alpha) \times r_{C}(t−1),} - - where \eqn{\alpha=2/(d2/\Delta t+1)} and \eqn{d2} is the length of filter -\eqn{L2} in hours. The model outputs are time-sampled relative non-visual -responses. } \examples{ @@ -141,7 +73,7 @@ dataset2.nvRC <- dataset2 \%>\% Amundadottir, M.L. (2016). Light-driven model for identifying indicators of non-visual health potential in the built environment [Doctoral dissertation, EPFL]. EPFL infoscience. -\url{http://dx.doi.org/10.5075/epfl-thesis-7146} +\doi{10.5075/epfl-thesis-7146} } \seealso{ Other metrics: diff --git a/man/nvRC_metrics.Rd b/man/nvRC_metrics.Rd index 1198239..8d0d528 100644 --- a/man/nvRC_metrics.Rd +++ b/man/nvRC_metrics.Rd @@ -56,8 +56,8 @@ and the circadian response to a reference profile. \code{nvRC_relativeAmplitudeError()} calculates the relative amplitude error (RAE). It is expressed as -\deqn{RAE(i,T)=r_{C,max}−r_{C,max}^{ref},} - +\deqn{RAE(i,T)=r_{C,max}-r_{C,max}^{ref},} + and quantifies the difference between the maximum response achieved in a period to the reference signal. } @@ -98,5 +98,5 @@ nvRC_relativeAmplitudeError(dataset1$nvRC, dataset.reference$nvRC) Amundadottir, M.L. (2016). Light-driven model for identifying indicators of non-visual health potential in the built environment [Doctoral dissertation, EPFL]. EPFL infoscience. -\url{http://dx.doi.org/10.5075/epfl-thesis-7146} +\doi{10.5075/epfl-thesis-7146} } diff --git a/man/nvRD.Rd b/man/nvRD.Rd index af27031..cb6dc74 100644 --- a/man/nvRD.Rd +++ b/man/nvRD.Rd @@ -11,13 +11,13 @@ nvRD(MEDI.vector, Illuminance.vector, Time.vector, epoch = "dominant.epoch") \item{Illuminance.vector}{Numeric vector containing the Illuminance data.} -\item{Time.vector}{Vector containing the time data. Can be \link[base]{POSIXct}, \link[hms]{hms}, -\link[lubridate]{duration}, or \link[base]{difftime}.} +\item{Time.vector}{Vector containing the time data. Can be \code{\link[=POSIXct]{POSIXct()}},\code{\link[hms:hms]{hms::hms()}}, +\code{\link[lubridate:duration]{lubridate::duration()}}, \code{\link[=difftime]{difftime()}}.} \item{epoch}{The epoch at which the data was sampled. Can be either a -\link[lubridate]{duration} or a string. If it is a string, it needs to be +\code{\link[lubridate:duration]{lubridate::duration()}} or a string. If it is a string, it needs to be either \code{"dominant.epoch"} (the default) for a guess based on the data, or a valid -\link[lubridate]{duration} string, e.g., \code{"1 day"} or \code{"10 sec"}.} +\code{\link[lubridate:duration]{lubridate::duration()}} string, e.g., \code{"1 day"} or \code{"10 sec"}.} } \value{ A numeric vector containing the nvRD data. The output has the same @@ -32,57 +32,6 @@ exposure signal to quantify the effective direct input to the non-visual system \details{ The timeseries is assumed to be regular. Missing values in the light data will be replaced by 0. - -The inputs to the model are discrete time samples of melanopic equivalent -daylight (D65) illuminance (mEDI) \eqn{E_{v,mel}^{D65}(t)}, transformed into -the effective light stimulus \eqn{I(t)}. - -\deqn{I(t) = E_{v,mel}^{D65} * K_{mel,v}^{D65}/A_{mel},} - -where \eqn{K_{mel,v}^{D65} = 1.3262 / 1000} is the melanopic normalization factor -to convert melanopic EDI to melanopic Irradiance and \eqn{A_{mel} = 97.07} is the -area of the melanopic sensitivity curve. - -The light stimulus \eqn{I(t)} is then passed through a linear filter \eqn{L1}, -which is associated with the temporal integration of the retina, to determine the -output \eqn{u(t)}. - -\deqn{u(t) = \frac{1}{d_{1}}\sum_{i=0}^{d_{1}/\Delta t} I(t-1)\Delta t,} - -where \eqn{d_{1}} is the length of filter \eqn{L1}. The time step size -\eqn{\Delta t} is the epoch at which the data was sampled. -Then \eqn{u(t)} is transformed by a nonlinear function \eqn{N(u)}, describing the -intensity-response relationship to the light stimulus, to determine the -output \eqn{v(t)}. - -\deqn{v(t) = N(u(t)) = \frac{1}{1+(\sigma(t)/u(t))^n}.} - -The half-maximum constant \eqn{\sigma} adapts to prior light history -\deqn{ - \begin{array}{ll} - \sigma(t)=\sigma_{0}/2, & \qquad & \forall u_{H}(t)<0,\\ - \sigma(t)=\sigma_{0}\times2^{u_{H}(t)-1}, & \qquad & \forall u_{H}(t)\geq 0. - \end{array} - } - -The prior history of light exposure is calculated using a moving window, -filter \eqn{LH}, to average the input - -\deqn{u_{H}(t) = \frac{1}{d_{H}}\sum_{i=0}^{d_{H}/\Delta t} - \log_{10}(E_{v}(t-i))\Delta t,} - -where \eqn{dH} is the width of the filter \eqn{LH} in hours and \eqn{E_{v}} -is the photopic illuminance. - -The signal \eqn{v(t)} is finally passed through a second filter \eqn{L2}, -which reflects the adaptation of the non-visual system to continuous light -exposure, to determine the final output \eqn{r_{D}(t)}. - -\deqn{r_{D}(t)=\alpha \times v(t−1)+(1−\alpha) \times r_{D}(t−1),} - - where \eqn{\alpha=2/(d2/\Delta t+1)} and \eqn{d2} is the length of filter -\eqn{L2} in hours. The model outputs are time-sampled relative non-visual -responses. } \examples{ @@ -118,7 +67,7 @@ dataset.combined.nvRD <- dataset.combined \%>\% Amundadottir, M.L. (2016). Light-driven model for identifying indicators of non-visual health potential in the built environment [Doctoral dissertation, EPFL]. EPFL infoscience. -\url{http://dx.doi.org/10.5075/epfl-thesis-7146} +\doi{10.5075/epfl-thesis-7146} } \seealso{ Other metrics: diff --git a/man/nvRD_cumulative_response.Rd b/man/nvRD_cumulative_response.Rd index 37a9451..095ac20 100644 --- a/man/nvRD_cumulative_response.Rd +++ b/man/nvRD_cumulative_response.Rd @@ -56,7 +56,7 @@ dataset1 \%>\% Amundadottir, M.L. (2016). Light-driven model for identifying indicators of non-visual health potential in the built environment [Doctoral dissertation, EPFL]. EPFL infoscience. -\url{http://dx.doi.org/10.5075/epfl-thesis-7146} +\doi{10.5075/epfl-thesis-7146} } \seealso{ Other metrics: diff --git a/man/pulses_above_threshold.Rd b/man/pulses_above_threshold.Rd index 2991193..04afe3f 100644 --- a/man/pulses_above_threshold.Rd +++ b/man/pulses_above_threshold.Rd @@ -109,7 +109,7 @@ data \%>\% Wilson, J., Reid, K. J., Braun, R. I., Abbott, S. M., & Zee, P. C. (2018). Habitual light exposure relative to circadian timing in delayed sleep-wake phase disorder. \emph{Sleep}, 41(11). -\url{https://doi.org/10.1093/sleep/zsy166} +\doi{10.1093/sleep/zsy166} } \seealso{ Other metrics: diff --git a/man/timing_above_threshold.Rd b/man/timing_above_threshold.Rd old mode 100755 new mode 100644 index 1ea388d..48c1f7f --- a/man/timing_above_threshold.Rd +++ b/man/timing_above_threshold.Rd @@ -72,11 +72,11 @@ dataset1 \%>\% Reid, K. J., Santostasi, G., Baron, K. G., Wilson, J., Kang, J., & Zee, P. C. (2014). Timing and Intensity of Light Correlate with Body Weight in Adults. \emph{PLOS ONE}, 9(4), e92251. -\url{https://doi.org/10.1371/journal.pone.0092251} +\doi{10.1371/journal.pone.0092251} Hartmeyer, S.L., Andersen, M. (2023). Towards a framework for light-dosimetry studies: Quantification metrics. \emph{Lighting Research & Technology}. -\url{https://doi.org/10.1177/14771535231170500} +\doi{10.1177/14771535231170500} } \seealso{ Other metrics: