From a3ba770ad29c98a14b85b55dcf9ccdc8339efd8a Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Tue, 5 Dec 2023 17:49:35 +0100 Subject: [PATCH 01/10] fixes #980 --- R/check_params.R | 19 +++++++------------ man/GGIR.Rd | 11 +++++------ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/R/check_params.R b/R/check_params.R index 0dc95c2ec..31ddbd12c 100644 --- a/R/check_params.R +++ b/R/check_params.R @@ -433,23 +433,18 @@ check_params = function(params_sleep = c(), params_metrics = c(), ", the default value has been assigned (i.e., 0.5) "), call. = FALSE) } else if (params_cleaning[["segmentWEARcrit.part5"]] < 0 | params_cleaning[["segmentWEARcrit.part5"]] > 1) { - stop(paste0("Incorrect value of segmentWEARcrit.part5, this should be a", - "fraction of the day between zero and one, please change."), + stop(paste0("Incorrect value of segmentWEARcrit.part5, this should be a ", + "fraction between zero and one, please change."), call. = FALSE) } if (length(params_cleaning[["segmentDAYSPTcrit.part5"]]) != 2) { stop("\nArgument segmentDAYSPTcrit.part5 is expected to be a numeric vector of length 2", call. = FALSE) } - if (sum(params_cleaning[["segmentDAYSPTcrit.part5"]]) < 0.5 | - 0 %in% params_cleaning[["segmentDAYSPTcrit.part5"]] == FALSE) { - - stop(paste0("\nIf you used argument segmentDAYSPTcrit.part5 then make sure", - " it includes one zero", - " and one value of at least 0.5, see documentation for", - " argument segmentDAYSPTcrit.part5. If you do not use", - " argument segmentDAYSPTcrit.part5", - " then delete it from your config.csv file (in your output folder)", - " or delete the config.csv file itself."), call. = FALSE) + if (any(params_cleaning[["segmentDAYSPTcrit.part5"]] < 0) | + any(params_cleaning[["segmentDAYSPTcrit.part5"]] > 1)) { + stop(paste0("Incorrect values of segmentDAYSPTcrit.part5, these should be a ", + "fractions between zero and one, please change."), + call. = FALSE) } } diff --git a/man/GGIR.Rd b/man/GGIR.Rd index 5c49b56ec..77942d805 100755 --- a/man/GGIR.Rd +++ b/man/GGIR.Rd @@ -862,22 +862,21 @@ GGIR(mode = 1:5, Numeric vector or length 2 (default = c(0.9, 0)). Inclusion criteria for the proportion of the segment that should be classified as day (awake) and spt (sleep period time) to be considered - valid. One of the two numbers should be 0, and the other defines the + valid. If you are interested in comparing time spent in behaviour then it + is better to set one of the two numbers to 0, and the other defines the proportion of the segment that should be classified as day or spt, respectively. The default setting would focus on waking hour segments and includes all segments that overlap for at least 90 percent with waking hours. In order to shift focus to the SPT you could use c(0, 0.9) which ensures that all segments that overlap for at least 90 percent with the SPT are included. - Setting both to zero would be problematic and is not allowed as that would introduce - bias in behavioural estimates for the following reason: A complete segment + Setting both to zero would be problematic when comparing time spent in + behaviours between days or individuals: A complete segment would be averaged with an incomplete segments (someone going to bed or waking up in the middle of a segment) by which it is no longer clear whether the person is less active or sleeps more during that segment. Similarly it is not clear whether the person has more wakefulness during SPT for a segment or - woke up or went to bed during the segment. Therefore, a - minimum value of 0.5 is required but any value closer to 1 - would be better. + woke up or went to bed during the segment. } \item{includedaycrit}{ Numeric (default = 16). From 0b7e65db5f97d5206489526130b65430af6ae40b Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Tue, 5 Dec 2023 18:09:46 +0100 Subject: [PATCH 02/10] fixes several typos in documentation, fixes #982 --- NEWS.md | 4 ++ R/check_params.R | 2 +- R/createConfigFile.R | 2 +- R/load_params.R | 2 +- man/GGIR.Rd | 92 ++++++++++++++++++------------------ vignettes/GGIRParameters.Rmd | 3 +- 6 files changed, 53 insertions(+), 52 deletions(-) diff --git a/NEWS.md b/NEWS.md index ef2345d25..53bb78670 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,10 @@ - Part 1: Now also able to handle some more variations in Actigraph csv count file format #978, and automatically aggregates to lower resolution if short epoch size is longer than observed epoch size in actigraph count csv. +- Part 5: Reverting decision to prohibit segmentDAYSPTcrit.part5 to be c(0, 0). The default remains unchanged and documentation now only emphasizes the downside of using c(0, 0). #980 + +- Argument documentation: Fixing series of typos (thanks to Pieter-Jan Marent for pointing them out) + # CHANGES IN GGIR VERSION 3.0-1 - Part 2: Added option to provide a csv file with start and end dates when accelerometer is expected to be worn #943 diff --git a/R/check_params.R b/R/check_params.R index 31ddbd12c..01647e2eb 100644 --- a/R/check_params.R +++ b/R/check_params.R @@ -78,7 +78,7 @@ check_params = function(params_sleep = c(), params_metrics = c(), numeric_params = c("qlevels", "ilevels", "IVIS_windowsize_minutes", "IVIS_epochsize_seconds", "IVIS.activity.metric", "IVIS_acc_threshold", "qM5L5", "MX.ig.min.dur", "M5L5res", "winhr", "LUXthresholds", "LUX_cal_constant", - "LUX_cal_exponent", "LUX_day_segments", "window.summary.size", "L5M5window") + "LUX_cal_exponent", "LUX_day_segments", "L5M5window") boolean_params = c("cosinor", "part6CR", "part6HCA") character_params = c("qwindow_dateformat", "part6Window") check_class("247", params = params_247, parnames = numeric_params, parclass = "numeric") diff --git a/R/createConfigFile.R b/R/createConfigFile.R index 463dce6b0..bc4586479 100644 --- a/R/createConfigFile.R +++ b/R/createConfigFile.R @@ -58,7 +58,7 @@ createConfigFile = function(config.parameters = c(), GGIRversion = "") { "includedaycrit", "M5L5res", "winhr", "qwindow", "qlevels", "ilevels", "mvpathreshold", "boutcriter", "ndayswindow", "do.imp", "epochvalues2csv", "mvpadur", - "window.summary.size", "dayborder", "closedbout", + "dayborder", "closedbout", "IVIS_windowsize_minutes", "IVIS_epochsize_seconds", "iglevels", "IVIS.activity.metric", "TimeSegments2ZeroFile", "qM5L5", "do.part3.pdf") == TRUE) { out[i,3] = "Study design, Parameters descriptive analysis" diff --git a/R/load_params.R b/R/load_params.R index eea3ffde3..0836fd237 100644 --- a/R/load_params.R +++ b/R/load_params.R @@ -73,7 +73,7 @@ load_params = function(topic = c("sleep", "metrics", "rawdata", MX.ig.min.dur = 10, M5L5res = 10, winhr = 5, iglevels = c(), LUXthresholds = c(0, 100, 500, 1000, 3000, 5000, 10000), LUX_cal_constant = c(), LUX_cal_exponent = c(), LUX_day_segments = c(), - window.summary.size = 10, L5M5window = c(0, 24), cosinor = FALSE, + L5M5window = c(0, 24), cosinor = FALSE, part6CR = FALSE, part6HCA = FALSE, part6Window = c("start", "end")) } diff --git a/man/GGIR.Rd b/man/GGIR.Rd index 77942d805..c5a58f169 100755 --- a/man/GGIR.Rd +++ b/man/GGIR.Rd @@ -150,11 +150,11 @@ GGIR(mode = 1:5, \item{part5_agg2_60seconds}{ Boolean (default = FALSE). - Wether to use aggregate epochs to 60 seconds as part of the GGIR \link{g.part5} analysis.} + Whether to use aggregate epochs to 60 seconds as part of the GGIR \link{g.part5} analysis.} \item{print.filename}{ Boolean (default = FALSE). - Whether to print the filename before before analysing it (in case do.parallel = FALSE). + Whether to print the filename before analysing it (in case do.parallel = FALSE). Printing the filename can be useful to investigate problems (e.g., to verify that which file is being read).} @@ -171,7 +171,7 @@ GGIR(mode = 1:5, \item{configtz}{ Character (default = "", i.e., system timezone). At the moment only functional for GENEActiv .bin, AX3 cwa, ActiGraph .gt3x, - and ad-hoc csv file format at the moment. + and ad-hoc csv file format. Timezone in which the accelerometer was configured. Only use this argument if the timezone of configuration and timezone in which recording took place are different. Use the "TZ identifier" as specified at @@ -207,7 +207,7 @@ GGIR(mode = 1:5, \item{expand_tail_max_hours}{ Numeric (default = NULL). - This parameter has been replaced for \code{recordingEndSleepHour}.} + This parameter has been replaced by \code{recordingEndSleepHour}.} \item{recordingEndSleepHour}{ Numeric (default = NULL). @@ -215,26 +215,26 @@ GGIR(mode = 1:5, \link{g.part1} output with synthetic data to trigger sleep detection for last night. Using argument \code{recordingEndSleepHour} implies the assumption that the participant fell asleep at or before the end of the recording if the recording - ended at or after \code{recordingEndSleepHour} hour of the last day. This assumption may not - always hold true and should be used with caution. + ended at or after \code{recordingEndSleepHour} hour of the last day. + This assumption may not always hold true and should be used with caution. The synthetic data for metashort entails: timestamps continuing regularly, zeros for acceleration metrics other than EN, one for EN. Angle columns are created in a way that it triggers the sleep detection using the equation: \code{round(sin((1:length_expansion) / (900/epochsize))) * 15}. - To keep track of the tail expansion \link{g.part1} stores the lenght of the expansion in + To keep track of the tail expansion \link{g.part1} stores the length of the expansion in the RData files, which is then passed via \link{g.part2}, \link{g.part3}, and \link{g.part4} to \link{g.part5}. In \link{g.part5} the tail expansion size is included as an additional variable in the csv-reports. - In the \link{g.part4} csv-report the last nigth is omitted, because we know + In the \link{g.part4} csv-report the last night is omitted, because we know that sleep estimates from the last night will not be trustworthy. Similarly, in the \link{g.part5} output columns related to the sleep assessment will - be omitted for the last window to avoid biassing the averages Further, + be omitted for the last window to avoid biasing the averages. Further, the synthetic data are also ignored in the visualizations and time series output to avoid biased output.} \item{dataFormat}{ Character (default = "raw"). - to indicate what the format is of the data in datadir. + To indicate what the format is of the data in datadir. Current alternatives: ukbiobank_csv, actiwatch_csv, and actiwatch_awd, which correspond to the 5, 15 and 60 second epoch level data files provided by UK Biobank in csv format, Actiwatch in csv format, and Actiwatch in awd format. @@ -249,8 +249,8 @@ GGIR(mode = 1:5, ID can be matched, make sure argument \code{idloc} is set correctly. If argument \code{maxRecordingInterval} is set to NULL (default) recordings are not appended. If recordings overlap then GGIR will use the data from - the latest recording. If recordings are seperated then the timegap between - the recordings is filled with data points that resembale monitor not worn. + the latest recording. If recordings are separated then the timegap between + the recordings is filled with data points that resemble monitor not worn. The maximum value of maxFile gap is 504 (21 days). Only recordings from the same accelerometer brand are appended. The part 2 csv report will show number of appended recordings, sampling rate for each, time overlap or gap @@ -333,7 +333,7 @@ GGIR(mode = 1:5, \item{chunksize}{ Numeric (default = 1). - Value between 0.2 and 1 to specificy the size of chunks to be + Value between 0.2 and 1 to specify the size of chunks to be loaded as a fraction of a 12 hour period, e.g., 0.5 equals 6 hour chunks, 1 equals 12 hour chunks. For machines with less than 4Gb of RAM memory a value below 1 is recommended.} @@ -387,7 +387,7 @@ GGIR(mode = 1:5, \item{rmc.col.temp}{ Numeric (default = NULL). Scalar with column (number) in which the temperature is stored. - Leave in default setting if no temperature is avaible. The temperature + Leave in default setting if no temperature is available. The temperature will be used by \link{g.calibrate}.} \item{rmc.col.time}{ @@ -666,10 +666,10 @@ GGIR(mode = 1:5, \item{do.brondcounts}{ Boolean (default = FALSE). - THIS OPTION HAS BEEN DEPRECATED (October2022) DUE TO ISSUES WITH THE ACTIVITYCOUNTS PACKAGE, - WE WILL ADD THIS BACK IN ONCE THE ISSUES WITH THE ACTIVITYCOUNTS PACKAGE ARE ADDRESSED. - If TRUE, calculates the metric via R package activityCounts. - We call them BrondCounts because there are large number of acitivty counts in + this option has been deprecated (October 2022) due to issues with the + activityCounts package that we used as a dependency. + If TRUE, calculated the metric via R package activityCounts. + We called them BrondCounts because there are large number of activity counts in the physical activity and sleep research field. By calling them _brondcounts_ we clarify that these are the counts proposed by Jan Brønd and implemented in R by Ruben Brondeel. The _brondcounts_ are intended to be an imitation of @@ -703,11 +703,11 @@ GGIR(mode = 1:5, \item{zc.lb}{ Numeric (default = 0.25). - Used for zero-crossing counts only. Lower boundery of cut-off frequency filter.} + Used for zero-crossing counts only. Lower boundary of cut-off frequency filter.} \item{zc.hb}{ Numeric (default = 3). - Used for zero-crossing counts only. Higher boundery of cut-off frequencies in filter.} + Used for zero-crossing counts only. Higher boundary of cut-off frequencies in filter.} \item{zc.sb}{ Numeric (default = 0.01). @@ -760,8 +760,8 @@ GGIR(mode = 1:5, \item{excludefirstlast.part5}{ Boolean (default = FALSE). - If TRUE then the first and last window (waking-waking or - midnight-midnight) are ignored in \link{g.part5}.} + If TRUE then the first and last window (waking-waking, + midnight-midnight, or sleep onset-onset) are ignored in \link{g.part5}.} \item{excludefirstlast}{ Boolean (default = FALSE). @@ -785,7 +785,7 @@ GGIR(mode = 1:5, \item{minimum_MM_length.part5}{ Numeric (default = 23). - Minimum length in hours of a MM day to be included in the cleaned \link{g.part4} results.} + Minimum length in hours of a MM day to be included in the cleaned \link{g.part5} results.} \item{study_dates_file}{ Character (default = c()). @@ -819,12 +819,12 @@ GGIR(mode = 1:5, midnight and the last midnight is used. data_masking_strategy = 3 selects the most active X days in the file where X is specified by argument \code{ndayswindow}, where the days are a series - of 24-h blocks starting any time in the day (X hours at the begining and end + of 24-h blocks starting any time in the day (X hours at the beginning and end of this period can be deleted with arguments \code{hrs.del.start} and \code{hrs.del.end}) data_masking_strategy = 4 to only use the data after the first midnight. data_masking_strategy = 5 is similar to \code{data_masking_strategy = 3}, but it selects X complete calendar days where X is specified by argument \code{ndayswindow} - (X hours at the begining and end of this period can be deleted with + (X hours at the beginning and end of this period can be deleted with arguments \code{hrs.del.start} and \code{hrs.del.end}).} \item{hrs.del.start}{ @@ -919,9 +919,11 @@ GGIR(mode = 1:5, \item{mvpathreshold}{ Numeric (default = 100). Acceleration threshold for MVPA estimation in GGIR \link{g.part2}. - This can be a single number or an array of numbers, e.g., \code{mvpathreshold = c(100, 120)}. - In the later case the code will estimate MVPA seperately for each threshold. - If this variable is left blank, e.g., \code{mvpathreshold = c()}, then MVPA is not estimated.} + This can be a single number or an array of numbers, + e.g., \code{mvpathreshold = c(100, 120)}. + In the latter case the code will estimate MVPA separately for each threshold. + If this variable is left blank, e.g., \code{mvpathreshold = c()}, then + MVPA is not estimated.} \item{mvpadur}{ Numeric (default = 10). @@ -946,8 +948,8 @@ GGIR(mode = 1:5, In \link{g.part5}: Threshold for moderate physical activity to separate light from moderate. Value can be one number or an array of multiple numbers, e.g., \code{threshold.mod = c(100, 120)}. - If multiple numbers are entered then analysis will be repliced for each - ombination of threshold values. Threshold is applied to the first metric in the + If multiple numbers are entered then analysis will be repeated for each + combination of threshold values. Threshold is applied to the first metric in the milestone data, so if you have only specified \code{do.enmo = TRUE} then it will be applied to ENMO.} @@ -956,7 +958,7 @@ GGIR(mode = 1:5, In \link{g.part5}: Threshold for vigorous physical activity to separate moderate from vigorous. Value can be one number or an array of multiple numbers, e.g., \code{threshold.vig =c(400,500)}. If multiple numbers are - entered then analysis will be repliced for each combination of threshold values. + entered then analysis will be repeated for each combination of threshold values. Threshold is applied to the first metric in the milestone data, so if you have only specified \code{do.enmo = TRUE} then it will be applied to ENMO.} @@ -969,7 +971,7 @@ GGIR(mode = 1:5, \item{boutdur.in}{ Numeric (default = c(10, 20, 30)). - Duration(s) of inactivty bouts in minutes to be extracted. + Duration(s) of inactivity bouts in minutes to be extracted. Inactivity bouts are detected in the segments of the data which were not labelled as sleep or MVPA bouts. It will start with the identification of the longest to the shortest duration. @@ -984,7 +986,7 @@ GGIR(mode = 1:5, \item{boutdur.lig}{ Numeric (default = c(1, 5, 10)). - Duration(s) of light activty bouts in minutes + Duration(s) of light activity bouts in minutes to be extracted. Light activity bouts are detected in the segments of the data which were not labelled as sleep, MVPA, or inactivity bouts. It will start with the identification of the longest to the shortest duration. @@ -1007,7 +1009,7 @@ GGIR(mode = 1:5, \item{frag.metrics}{ Character (default = NULL). - Fragmentation metric to exract. Can be "mean", "TP", "Gini", + Fragmentation metric to extract. Can be "mean", "TP", "Gini", "power", or "CoV", "NFragPM", or all the above metrics with "all". See package vignette for description of fragmentation metrics.} @@ -1163,6 +1165,7 @@ GGIR(mode = 1:5, when argument \code{sleepwindowType = "TimeInBed"}} \item{possible_nap_edge_acc}{ + Numeric (default = Inf). Minimum acceleration before or after the SIB for the nap to be considered. } } @@ -1193,16 +1196,16 @@ GGIR(mode = 1:5, with start times for the activity types in that day format in hours:minutes:seconds. The header of the column will be used as label for each activity type. Insert a new date column before continuing with activity types for next day. - Leave missing values empty. If an activitylog is used then individuals who - do not appear in the activitylog will still be processed with value - \code{qwindow = c(0, 24)}. Dates with no activiy log data can be skipped, + Leave missing values empty. If an activity log is used then individuals who + do not appear in the activity log will still be processed with value + \code{qwindow = c(0, 24)}. Dates with no activity log data can be skipped, no need to have a column with the date followed by a column with the next date. If times in the activity diary are not multiple of the short window size (epoch length), the next epoch is considered (e.g., with epoch of 5 seconds, 8:00:02 will be redefined as 8:00:05 in the activity log). When using the qwindow functionality in combination with GGIR part 5 then make sure to check that arguments \code{segmentWEARcrit.part5} and - \code{segmentDAYSPTcrit.part5} are specfied to your research needs. + \code{segmentDAYSPTcrit.part5} are specified to your research needs. } \item{qwindow_dateformat}{ @@ -1233,11 +1236,6 @@ GGIR(mode = 1:5, If left empty then the intensity levels will not be extracted. Distribution will be derived from short epoch metric data.} - \item{window.summary.size}{ - Numeric (default = 10). - Functionality designed for the London Centre - of Longidutinal studies. Size in minutes of the summary window} - \item{iglevels}{ Numeric (default = NULL). Levels for acceleration value frequency distribution @@ -1262,7 +1260,7 @@ GGIR(mode = 1:5, Metric used for activity calculation. Value = 1, uses continuous scaled acceleration. Value = 2, tries to collapse acceleration into a binary score of rest - versus active to try to similate the original approach.} + versus active to try to simulate the original approach.} \item{IVIS_acc_threshold}{ Numeric (default = 20). @@ -1278,7 +1276,7 @@ GGIR(mode = 1:5, \item{LUXthresholds}{ Numeric (default = c(0, 100, 500, 1000, 3000, 5000, 10000)). - Vector with numeric sequece corresponding to + Vector with numeric sequence corresponding to the thresholds used to calculate time spent in LUX ranges.} \item{LUX_cal_constant}{ @@ -1378,7 +1376,7 @@ GGIR(mode = 1:5, inactivity bouts (SIB). If set to TRUE and when an advanced sleep diary is available in part 4 then part 5 will use this to generate summary statistics on the overlap between self-reported nonwear and napping with SIB. Here, - SIB cna be filter based on argument possible_nap_edge_acc and the first value + SIB can be filter based on argument possible_nap_edge_acc and the first value of possible_nap_dur} \item{do.visual}{ @@ -1415,7 +1413,7 @@ GGIR(mode = 1:5, into making sure that the csv-report are correct, while the visualreport has mostly been a side project. This is unfortunate and we hope to find funding in the future to design a new report specifically for the purpose of - QC-ing the anlayses done by GGIR.} + QC-ing the analyses done by GGIR.} \item{viewingwindow}{ Numeric (default = 1). diff --git a/vignettes/GGIRParameters.Rmd b/vignettes/GGIRParameters.Rmd index 4ed1f2992..03fcd647e 100644 --- a/vignettes/GGIRParameters.Rmd +++ b/vignettes/GGIRParameters.Rmd @@ -124,7 +124,7 @@ find a description and default value for all the arguments. | maxRecordingInterval | 1 | params_general | | nonwear_approach | 1 | params_general | | dataFormat | 1 | params_general | -| extEpochData_dateformat | 1 | params_general | +| extEpochData_timeformat | 1 | params_general | | metadatadir | 2, 3, 4, 5 | not in parameter objects | | minimum_MM_length.part5 | 5 | params_cleaning | | strategy | 2, 5 | params_cleaning | @@ -149,7 +149,6 @@ find a description and default value for all the arguments. | epochvalues2csv | 2 | params_output | | do.part2.pdf | 2 | params_output | | mvpadur | 2 | params_phyact | -| window.summary.size | 2 | params_247 | | bout.metric | 2, 5 | params_phyact | | closedbout | 2 | params_phyact | | IVIS_windowsize_minutes | 2 | params_247 | From 7bd9a33ad24e9ebdeff528a1186e7506754eaa8d Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Tue, 5 Dec 2023 18:24:11 +0100 Subject: [PATCH 03/10] remove duplication in unit test and correct numbers --- tests/testthat/test_load_check_params.R | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/testthat/test_load_check_params.R b/tests/testthat/test_load_check_params.R index fb3c87972..162823e1e 100644 --- a/tests/testthat/test_load_check_params.R +++ b/tests/testthat/test_load_check_params.R @@ -13,10 +13,7 @@ test_that("load_params can load parameters", { expect_equal(length(params$params_sleep), 22) expect_equal(length(params$params_metrics), 41) expect_equal(length(params$params_rawdata), 38) - expect_equal(length(params$params_247), 23) - expect_equal(length(params$params_cleaning), 24) - expect_equal(length(params$params_phyact), 14) - expect_equal(length(params$params_247), 23) + expect_equal(length(params$params_247), 22) expect_equal(length(params$params_cleaning), 24) expect_equal(length(params$params_phyact), 14) expect_equal(length(params$params_output), 19) From 30104a955a1ebde9d23122e39f7a162026465f89 Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Tue, 5 Dec 2023 19:00:03 +0100 Subject: [PATCH 04/10] Update r_codecov.yml --- .github/workflows/r_codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/r_codecov.yml b/.github/workflows/r_codecov.yml index 2db2ef67f..b7bef8ae4 100644 --- a/.github/workflows/r_codecov.yml +++ b/.github/workflows/r_codecov.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - + patch: off steps: - uses: actions/checkout@v2 From 7e29e5a6c577a19b75bd7d9b4353cfd658e7d594 Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Tue, 5 Dec 2023 19:01:33 +0100 Subject: [PATCH 05/10] undo previous commit --- .github/workflows/r_codecov.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/r_codecov.yml b/.github/workflows/r_codecov.yml index b7bef8ae4..3f6c0231f 100644 --- a/.github/workflows/r_codecov.yml +++ b/.github/workflows/r_codecov.yml @@ -13,7 +13,6 @@ jobs: runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - patch: off steps: - uses: actions/checkout@v2 From 4ec5ff27e931f8fdc86110482a826a30aef4a8de Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Tue, 5 Dec 2023 19:20:05 +0100 Subject: [PATCH 06/10] Update r_codecov.yml --- .github/workflows/r_codecov.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/r_codecov.yml b/.github/workflows/r_codecov.yml index 3f6c0231f..e06c55aa8 100644 --- a/.github/workflows/r_codecov.yml +++ b/.github/workflows/r_codecov.yml @@ -13,8 +13,9 @@ jobs: runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-r@v2 with: @@ -22,8 +23,28 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: covr, any::rcmdcheck, any::XML + extra-packages: any::covr + needs: coverage - name: Test coverage - run: covr::codecov() - shell: Rscript {0} \ No newline at end of file + run: | + covr::codecov( + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) + shell: Rscript {0} + + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v3 + with: + name: coverage-test-failures + path: ${{ runner.temp }}/package \ No newline at end of file From 9be81228238bd3eb3de04a7fce6e33465ed4611a Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Tue, 5 Dec 2023 21:06:48 +0100 Subject: [PATCH 07/10] Update r_codecov.yml --- .github/workflows/r_codecov.yml | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/.github/workflows/r_codecov.yml b/.github/workflows/r_codecov.yml index e06c55aa8..5a94268d3 100644 --- a/.github/workflows/r_codecov.yml +++ b/.github/workflows/r_codecov.yml @@ -23,28 +23,8 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::covr - needs: coverage + extra-packages: covr - name: Test coverage - run: | - covr::codecov( - quiet = FALSE, - clean = FALSE, - install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") - ) - shell: Rscript {0} - - - name: Show testthat output - if: always() - run: | - ## -------------------------------------------------------------------- - find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash - - - name: Upload test results - if: failure() - uses: actions/upload-artifact@v3 - with: - name: coverage-test-failures - path: ${{ runner.temp }}/package \ No newline at end of file + run: covr::codecov() + shell: Rscript {0} \ No newline at end of file From b6df3fd4aac911ad38303b4109950a30e83d0135 Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Tue, 5 Dec 2023 21:15:14 +0100 Subject: [PATCH 08/10] improve coverage for checkparams --- tests/testthat/test_load_check_params.R | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/testthat/test_load_check_params.R b/tests/testthat/test_load_check_params.R index 162823e1e..0c332b89b 100644 --- a/tests/testthat/test_load_check_params.R +++ b/tests/testthat/test_load_check_params.R @@ -221,4 +221,16 @@ test_that("load_params can load parameters", { params_cleaning$segmentWEARcrit.part5 = 16 expect_error(check_params(params_cleaning = params_cleaning), regexp = "Incorrect value of segmentWEARcrit.part5") + params_cleaning$segmentWEARcrit.part5 = 0.5 + + # segmentDAYSPTcrit.part5 should be two numbers between 0 and 1 + params_cleaning$segmentDAYSPTcrit.part5 = NULL + expect_error(check_params(params_cleaning = params_cleaning), + regexp = "Argument segmentDAYSPTcrit.part5 is expected to be a numeric vector of length 2") + params_cleaning$segmentDAYSPTcrit.part5 = c(-1, 0) + expect_error(check_params(params_cleaning = params_cleaning), + regexp = paste0("Incorrect values of segmentDAYSPTcrit.part5,", + " these should be a fractions between zero", + " and one, please change.")) + }) From ee034b8cd7e61f02c1792b8a99247f8ece04cd26 Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Tue, 5 Dec 2023 21:16:54 +0100 Subject: [PATCH 09/10] turn off patch as this seems to be the mean cause of frustration --- .github/workflows/r_codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/r_codecov.yml b/.github/workflows/r_codecov.yml index 5a94268d3..d950dd45c 100644 --- a/.github/workflows/r_codecov.yml +++ b/.github/workflows/r_codecov.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - + patch: off steps: - uses: actions/checkout@v3 From a464699212a783409716e2007f794faf737d1389 Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Wed, 6 Dec 2023 16:31:14 +0100 Subject: [PATCH 10/10] Clarify that threshold equals cut-point --- vignettes/CutPoints.Rmd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vignettes/CutPoints.Rmd b/vignettes/CutPoints.Rmd index 20815f2b8..ab05297b0 100644 --- a/vignettes/CutPoints.Rmd +++ b/vignettes/CutPoints.Rmd @@ -26,6 +26,8 @@ See also complementary vignettes on: The physical activity research field has used so called cut-points to segment accelerometer time series based on level of intensity. In this vignette we have compiled a list of published cut-points with instructions on how to use them with GGIR. +Please note that GGIR refers to cut-points as thresholds, but we are referring to the +same thing: A value or a set of values to help split levels of movement intensity. As newer cut-points are frequently published the list below may not be up to date. **Please let us know if you are aware of any published cut-points that we missed!**