Skip to content

Commit

Permalink
Merge branch 'issue1148_wear_percentage_part5' into issues_1082Date_1…
Browse files Browse the repository at this point in the history
…089NotWorn
  • Loading branch information
vincentvanhees committed Jun 6, 2024
2 parents f07718d + 21b6e63 commit 8e4d702
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ RELEASE_CYCLE.md
^CRAN-SUBMISSION$
^_pkgdown\.yml$
^docs$
^docs
^pkgdown$
^vignettes/chapter.*\\.Rmd$
^vignettes/chapter*
^dev-functions$
.zenodo.json
^doc$
Expand Down
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Describe your PR here -->

<!-- Please, make sure the following items are checked -->
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).
Expand All @@ -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`
Expand Down
18 changes: 12 additions & 6 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down
5 changes: 1 addition & 4 deletions R/g.report.part4.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""))) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/g.report.part5.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8e4d702

Please sign in to comment.