Skip to content

Commit

Permalink
expect no or at least two values for parameter clevels #653
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentvanhees committed Aug 7, 2024
1 parent 5defbcb commit ff883c2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions R/check_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ check_params = function(params_sleep = c(), params_metrics = c(),
params_output[["save_ms5rawlevels"]] = TRUE
params_output[["save_ms5raw_without_invalid"]] = FALSE
}
if (length(params_247[["clevels"]]) == 1) {
warning("\nParameter clevels expects a number vector of at least 2 values, current length is 1", call. = FALSE)
}
}
if (!is.null(params_general[["expand_tail_max_hours"]])) {
if (is.null(params_general[["recordingEndSleepHour"]]) & params_general[["expand_tail_max_hours"]] != 0) {
Expand Down
2 changes: 1 addition & 1 deletion R/g.part5_analyseSegment.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ g.part5_analyseSegment = function(indexlog, timeList, levelList,
#======================================================
# STEPS... (IF STEP_COUNT IS AVAILABLE)
if ("step_count" %in% names(ts)) {
if (length(params_247[["clevels"]]) > 0) {
if (length(params_247[["clevels"]]) > 1) {
for (windowhalf in c("day", "spt")) {
step_subsegment = sse[ts$diur[sse] == ifelse(windowhalf == "day", yes = 0, no = 1)]
cadence = ts$step_count[step_subsegment] / (60 / ws3new)
Expand Down
5 changes: 3 additions & 2 deletions man/GGIR.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -1399,8 +1399,9 @@ GGIR(mode = 1:5,
onset till the 10th wakeup time.
}
\item{clevel}{
Numeric vector (default = c(30, 150)) to indicate cadence ranges used
when summarising step counts, if available.
Numeric vector (default = c(30, 150)) with length 2 to indicate cadence ranges used
when summarising step counts, if available. When set to NULL, step counts will not be
summarised in part 5 output.
}
}
}
Expand Down

0 comments on commit ff883c2

Please sign in to comment.