Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: LightLogR
Title: Process Data from Wearable Light Loggers and Optical Radiation Dosimeters
Version: 0.10.0
Version: 0.10.1
Authors@R: c(
person("Johannes", "Zauner",
email = "johannes.zauner@tum.de", role = c("aut", "cre"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# LightLogR 0.10.1

* `extract_metric()` give more helpful error messages when using a base dataset without start/end columns.

* `mean_daily()` can output the number of days that factor into the calculations by setting `.n = TRUE`.

# LightLogR 0.10.0 **High noon**

## General improvements and new functions
Expand Down
3 changes: 3 additions & 0 deletions R/extract_metric.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ extract_metric <- function(

#if identifying.colname ist not part of the dataset, it will be added from the extracted_data
if (!cc.name %in% names(data)) {
if(!all(c("start", "end") %in% names(extracted_data))) {
stop("start and/or end columns are missing in extracted_data, please either choose and `identifying.colname` that is part of `extracted_data`, or add start and end columns.")
}
data <-
data |>
dplyr::left_join(
Expand Down
13 changes: 11 additions & 2 deletions R/mean_daily.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#' affected).
#' @param Datetime2Time.circular Logical of whether Time should be circular.
#' Will be ignored if `Datetime2Time = FALSE`. Default is `FALSE`.
#' @param .n Logical, whether the number of days that went into each category
#' should be output. Default is `FALSE`.
#'
#' @return A dataframe with three rows representing average weekday, weekend,
#' and mean daily values of all numeric columns
Expand Down Expand Up @@ -69,7 +71,8 @@ mean_daily <- function(data,
filter.empty = FALSE,
sub.zero = FALSE,
Datetime2Time = TRUE,
Datetime2Time.circular = FALSE
Datetime2Time.circular = FALSE,
.n = FALSE
) {

# Input validation
Expand Down Expand Up @@ -134,6 +137,7 @@ mean_daily <- function(data,
mean(x, na.rm = na.rm)
},
.names = "{prefix}{.col}"),
.n = dplyr::n(),
.groups = "drop_last")

if(nrow(weekday_type) == 0) {
Expand Down Expand Up @@ -172,14 +176,15 @@ mean_daily <- function(data,
)
)|>
dplyr::summarize(
dplyr::across(-c({{ Weekend.type }}, dplyr::where(lubridate::is.Date)),
dplyr::across(-c({{ Weekend.type }}, .n, dplyr::where(lubridate::is.Date)),
\(x) if(inherits(x, "Duration")) {
lubridate::duration(sum(x*.weight)/7) |> round(0)
} else if (inherits(x, "hms")) {
hms::as_hms((sum(x*.weight)/7) |> round(0))
} else {
sum(x*.weight)/7
}),
.n = sum(.n),
.groups = "keep"
) |>
dplyr::select(-.weight) |>
Expand All @@ -191,6 +196,10 @@ mean_daily <- function(data,
dplyr::bind_rows(mean_daily) |>
dplyr::arrange({{ Weekend.type }}, .by_group = TRUE)

if(!.n) {
weekday_type <- weekday_type |> dplyr::select(-.n)
}

#filter out empty rows
if(filter.empty){
weekday_type |>
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ If you would like to use a metric you don't find represented in LightLogR, pleas

## About the creation and funding of LightLogR

**LightLogR** is developed by the [*Translational Sensory & Circadian Neuroscience*](https://www.tscnlab.org) lab, a joint group from the [Technical University of Munich](https://www.tum.de/en/) and the [Max Planck Institute for Biological Neuroscience Unit (MPS/TUM/TUMCREATE)\*](https://www.tscnlab.org), a joint group based at the [Technical University of Munich](https://www.tum.de/en/), [TUMCREATE](https://www.tum-create.edu.sg/), the [Max Planck Institute for Biological Cybernetics](https://www.mpg.de/152075/biological-cybernetics).
**LightLogR** is developed by the [*Translational Sensory & Circadian Neuroscience Unit (MPS/TUM/TUMCREATE*](https://www.tscnlab.org), a joint group based at the [Max Planck Institute for Biological Cybernetics](https://www.mpg.de/152075/biological-cybernetics), the [Technical University of Munich](https://www.tum.de/en/), and [TUMCREATE](https://www.tum-create.edu.sg/), .

[*MeLiDos*](https://www.melidos.eu) is a joint, [EURAMET](https://www.euramet.org)-funded project involving sixteen partners across Europe, aimed at developing a metrology and a standard workflow for wearable light logger data and optical radiation dosimeters. Its primary contributions towards fostering FAIR data include the development of a common file format, robust metadata descriptors, and an accompanying open-source software ecosystem.

Expand Down
8 changes: 5 additions & 3 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ navbar:
newsletter:
text: Newsletter
menu:
- text: January 2026
href: Edition02.html
- text: July 2025
href: Edition01.html
resources:
Expand All @@ -19,8 +21,8 @@ navbar:
- text: Course website
href: https://tscnlab.github.io/LightLogR_webinar/
target: "_blank"
- text: Flyer (2025/26)
href: pdf/Online_course_series_2025-26.pdf
- text: Flyer
href: https://tscnlab.github.io/LightLogR_webinar/assets/Online_course_series_2025-26.pdf
target: "_blank"
- text: ---
- text: Talks
Expand All @@ -47,7 +49,7 @@ navbar:
- text: The whole game
href: articles/Day.html
- text: Visual experience
href: https://tscnlab.github.io/ZaunerEtAl_JVis_2025/
href: https://tscnlab.github.io/ZaunerEtAl_JVis_2026/
target: "_blank"
- text: '---'
- text: 'General Workflow'
Expand Down
6 changes: 5 additions & 1 deletion man/mean_daily.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading