diff --git a/.Rbuildignore b/.Rbuildignore index 1004b4bbc..8732c6e6e 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,8 +9,9 @@ RELEASE_CYCLE.md ^CRAN-SUBMISSION$ ^_pkgdown\.yml$ ^docs$ +^docs ^pkgdown$ -^vignettes/chapter.*\\.Rmd$ +^vignettes/chapter* ^dev-functions$ .zenodo.json ^doc$ diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d8947b1a5..3cf0b51b6 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,7 @@ -Checklist before merging: +### Checklist before merging: - [ ] Existing tests still work (check by running the test suite, e.g. from RStudio). - [ ] Added tests (if you added functionality) or fixed existing test (if you fixed a bug). @@ -15,14 +15,14 @@ Checklist before merging: - [ ] Added your name to the contributors lists in the `DESCRIPTION` file, if you think you made a significant contribution. - [ ] GGIR parameters were added/removed. If yes, please also complete checklist below. -If NEW GGIR parameter(s) were added then these NEW parameter(s) are : +**If NEW GGIR parameter(s) were added then these NEW parameter(s) are:** - [ ] documented in `man/GGIR.Rd` - [ ] included with a default in `R/load_params.R` - [ ] included with value class check in `R/check_params.R` - [ ] included in table of `vignettes/GGIRParameters.Rmd` with references to the GGIR parts the parameter is used in. - [ ] mentioned in NEWS.Rd as NEW parameter -If GGIR parameter(s) were deprecated these parameter(s) are: +**If GGIR parameter(s) were deprecated these parameter(s) are:** - [ ] documented as deprecated in `man/GGIR.Rd` - [ ] removed from `R/load_params.R` - [ ] removed from `R/check_params.R` diff --git a/NEWS.md b/NEWS.md index b99b1d540..09efdf42c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# CHANGES IN GGIR VERSION 3.1-2 + +- Report part 5: fix bug that was introduced on 2024-Feb-19 in the calculation of wear percentage #1148 + +- Part 3 and 4: Revise NotWorn algorithm to work with both count and raw data with varying degrees of nonwear. + +- Visualreport: Improve handling of recordings where the accelerometer was not worn. + # CHANGES IN GGIR VERSION 3.1-1 - Part 2: Corrected calculation of LXhr and MXhr which had one hour offset when timing was after midnight, #1117 @@ -6,15 +14,13 @@ - Loading GGIR: Stops interactive calling of `chooseCRANmirror` on `.onAttach` if interactive and CRAN mirror not set #1141. -- Part 4: Corrected documentation for parameter relyonguider. - -- Part 3 and 4: Revise NotWorn algorithm to work with both count and raw data with varying degrees of nonwear. +- Part 4: -- Visualreport: Improve handling of recordings where the accelerometer was not worn. + - Corrected documentation for parameter relyonguider. -- Part 4: Ignore empty sleeplog columns, which are sometimes accidentally created the user. GGIR can now handle these. #1138 + - Ignore empty sleeplog columns, which are sometimes accidentally created the user. GGIR can now handle these. #1138 -- Part 4 report: Bug fixed causing night_part4 column to not be used #1142. + - report: Bug fixed causing night_part4 column to not be used #1142. - Part 5: Fix incorrect calendar date when window starts 5 seconds before midnight, #1082 diff --git a/R/g.report.part4.R b/R/g.report.part4.R index 290c52341..18aeb3d45 100644 --- a/R/g.report.part4.R +++ b/R/g.report.part4.R @@ -75,6 +75,7 @@ g.report.part4 = function(datadir = c(), metadatadir = c(), loglocation = c(), out = as.matrix(nightsummary) } nightsummary2 = as.data.frame(do.call(rbind, lapply(fnames.ms4, myfun)), stringsAsFactors = FALSE) + nightsummary2$night = as.numeric(gsub(" ", "", nightsummary2$night)) # ====================================== Add non-wearing during SPT from part 5, if it is availabe: ms5.out = "/meta/ms5.out" if (file.exists(paste(metadatadir, ms5.out, sep = ""))) { @@ -131,7 +132,6 @@ g.report.part4 = function(datadir = c(), metadatadir = c(), loglocation = c(), } } # merge in variable - nightsummary2$night = as.numeric(gsub(" ", "", nightsummary2$night)) outputp5$night = as.numeric(outputp5$night) nightsummary2 = base::merge(nightsummary2, outputp5, by = c("ID", "night"), all.x = TRUE) if (remove_oldID == TRUE) { @@ -194,9 +194,6 @@ g.report.part4 = function(datadir = c(), metadatadir = c(), loglocation = c(), if (length(data_cleaning_file) > 0) { DaCleanFile = data.table::fread(data_cleaning_file, data.table = FALSE) if ("night_part4" %in% colnames(DaCleanFile)) { - if (inherits(x = nightsummary$night, "character")) { - nightsummary$night = as.numeric(gsub(pattern = " ", replacement = "", x = nightsummary$night)) - } days2exclude = which(nightsummary$ID %in% DaCleanFile$ID & nightsummary$night %in% DaCleanFile$night_part4) if (length(days2exclude) == 0 & inherits(x = nightsummary$ID, "character")) { # Try again by now attempt to read ID as numeric diff --git a/R/g.report.part5.R b/R/g.report.part5.R index ce5e0d046..020f8017a 100644 --- a/R/g.report.part5.R +++ b/R/g.report.part5.R @@ -50,7 +50,7 @@ g.report.part5 = function(metadatadir = c(), f0 = c(), f1 = c(), loglocation = c x$wear_min_day_spt = (1 - (x$nonwear_perc_day_spt / 100)) * x$dur_day_spt_min #valid minute during waking hours x$wear_min_day = (1 - (x$nonwear_perc_day / 100)) * x$dur_day_min #valid minute during waking hours - x$wear_perc_day = 100 - (x$nonwear_perc_day / 100) #wear percentage during waking hours + x$wear_perc_day = 100 - x$nonwear_perc_day #wear percentage during waking hours minimumValidMinutesMM = 0 # default if (length(params_cleaning[["includedaycrit"]]) == 2) {