Skip to content
Open
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
7 changes: 4 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
- [ ] Function documentation
- [ ] Chapter vignettes for GitHub IO
- [ ] Vignettes for CRAN
- [ ] Data dictionaries: if columns were added to or renamed in the output reports, their definitions are included in the corresponding `g.report.part*_dictionary` function (check with `dev-functions/reviewDictionaries.R`)
- [ ] Corresponding issue tagged in PR message. If no issue exist, please create an issue and tag it.
- [ ] Updated release notes in `inst/NEWS.Rd` with a user-readable summary. Please, include references to relevant issues or PR discussions.
- [ ] Updated release notes in `NEWS.md` with a user-readable summary. Please, include references to relevant issues or PR discussions.
- [ ] If you think you made a significant contribution, add your name to the contributors lists in the `DESCRIPTION`, `zenodo.json`, and `inst/CITATION` files.
- [ ] GGIR parameters were added/removed. If yes, please also complete checklist below.

Expand All @@ -20,12 +21,12 @@
- [ ] 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
- [ ] mentioned in NEWS.md as NEW parameter

**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`
- [ ] removed from table in `vignettes/GGIRParameters.Rmd`
- [ ] mentioned as deprecated parameter in NEWS.Rd
- [ ] mentioned as deprecated parameter in NEWS.md
- [ ] added to the list in `R/extract_params.R` with deprecated parameters such that these do not produce warnings when found in old config.csv files.
4 changes: 3 additions & 1 deletion .github/workflows/r_codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
needs: coverage

- name: Test coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
covr::codecov(
quiet = FALSE,
Expand All @@ -46,4 +48,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
path: ${{ runner.temp }}/package
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export(g.analyse, g.calibrate,
g.part5_analyseSegment, g.part5_initialise_ts,
g.part5.analyseRest, part6AlignIndividuals,
part6PairwiseAggregation, g.part6, g.report.part6,
check_log, g.report.part5_dictionary, DFA, ABI, SSP, visualReport,
check_log, g.report.part5_dictionary, g.report.part2_dictionary,
g.report.part4_dictionary, g.report.part6_dictionary, DFA, ABI, SSP, visualReport,
splitRecords, getSplitNames, addSplitNames, getPart1BasicInfo,
markerButtonForRest, aggregateEvent, inspect_binFile_brand,
g.part3_correct_guider, g.part3_alignIndexVectors, filterNonwearNight,
Expand Down
142 changes: 80 additions & 62 deletions NEWS.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions R/GGIR.R
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ GGIR = function(mode = 1:5, datadir = c(), outputdir = c(),
g.report.part2(metadatadir = metadatadir, f0 = f0, f1 = f1,
store.long = store.long, params_output,
verbose = verbose, desiredtz = params_general[["desiredtz"]])
g.report.part2_dictionary(metadatadir = metadatadir, params_output = params_output)
}
}
if (length(which(do.report == 4)) > 0) {
Expand All @@ -440,6 +441,7 @@ GGIR = function(mode = 1:5, datadir = c(), outputdir = c(),
data_cleaning_file = params_cleaning[["data_cleaning_file"]],
params_sleep = params_sleep, params_output = params_output,
verbose = verbose)
g.report.part4_dictionary(metadatadir = metadatadir, params_output = params_output)
}
}
if (length(which(do.report == 5)) > 0) {
Expand Down Expand Up @@ -467,6 +469,7 @@ GGIR = function(mode = 1:5, datadir = c(), outputdir = c(),
g.report.part6(metadatadir = metadatadir, f0 = f0, f1 = f1,
params_cleaning = params_cleaning, params_output = params_output,
verbose = verbose)
g.report.part6_dictionary(metadatadir = metadatadir, params_output = params_output)
}
}
if (params_output[["visualreport"]] == TRUE) {
Expand Down
66 changes: 35 additions & 31 deletions R/aggregateEvent.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,46 +154,50 @@ aggregateEvent = function(metric_name, epochsize,
# Describe for MX and LX:
LXMXwindow_name = anwi_nameindices[anwi_index]
for (WX in c("L", "M")) {
if (!all(is.na(MXLXout[, grep("M", names(MXLXout))]))) {
# When LX/MX cannot be calculated (e.g., segment shorter than winhr),
# the variables are still stored (as NA) to keep the columns aligned
# across days
LXMXavailable = !all(is.na(MXLXout[, grep("M", names(MXLXout))]))
if (LXMXavailable) {
i0 = MXLXout[, grep(paste0("start_", WX, winhr_value), names(MXLXout))]
i1 = MXLXout[, grep(paste0("end_", WX, winhr_value), names(MXLXout))]
WXi = i0:i1
# # Code used to help check that MXLX makes sense with real study data
# x11()
# plot(cadence, type = "l")
# lines(WXi, cadence[WXi], type = "l", col = "red")

# Timing
daysummary[di, fi] = MXLXout[, which(names(MXLXout) == paste0(WX, winhr_value, "hr"))]
ds_names[fi] = paste0("ExtFunEvent_", WX, winhr_value, "hr_cad",
event_suffix, LXMXwindow_name); fi = fi + 1
# cadence in the form of mean, percentiles.
daysummary[di, fi] = mean(cadence[WXi])
ds_names[fi] = paste0("ExtFunEvent_", WX, winhr_value, "_cad_meancad",
event_suffix, LXMXwindow_name); fi = fi + 1
}
# # Code used to help check that MXLX makes sense with real study data
# x11()
# plot(cadence, type = "l")
# lines(WXi, cadence[WXi], type = "l", col = "red")

# Timing
daysummary[di, fi] = MXLXout[, which(names(MXLXout) == paste0(WX, winhr_value, "hr"))]
ds_names[fi] = paste0("ExtFunEvent_", WX, winhr_value, "hr_cad",
event_suffix, LXMXwindow_name); fi = fi + 1
# cadence in the form of mean, percentiles.
daysummary[di, fi] = ifelse(LXMXavailable, mean(cadence[WXi]), NA)
ds_names[fi] = paste0("ExtFunEvent_", WX, winhr_value, "_cad_meancad",
event_suffix, LXMXwindow_name); fi = fi + 1
if (length(params_247[["qM5L5"]]) > 0) {
for (qle in params_247[["qM5L5"]]) {
daysummary[di, fi] = ifelse(LXMXavailable, quantile(x = cadence[WXi], probs = qle), NA)
ds_names[fi] = paste0("ExtFunEvent_", WX, winhr_value, "_cad_q",
qle * 100, "cad", event_suffix,
LXMXwindow_name); fi = fi + 1
}
}
for (ami in 1:length(acc.metrics)) {
# Acceleration in the form of mean, percentiles.
daysummary[di, fi] = ifelse(LXMXavailable, mean(vari[WXi, acc.metrics[ami]]) * 1000, NA)
ds_names[fi] = paste0("ExtFunEvent_", WX, winhr_value, "_cad_mean_",
acc.metrics[ami], "_mg", event_suffix,
LXMXwindow_name); fi = fi + 1
if (length(params_247[["qM5L5"]]) > 0) {
for (qle in params_247[["qM5L5"]]) {
daysummary[di, fi] = quantile(x = cadence[WXi], probs = qle)
daysummary[di, fi] = ifelse(LXMXavailable, quantile(x = vari[WXi, acc.metrics[ami]], probs = qle) * 1000, NA)
ds_names[fi] = paste0("ExtFunEvent_", WX, winhr_value, "_cad_q",
qle * 100, "cad", event_suffix,
qle * 100, "_", acc.metrics[ami], "_mg", event_suffix,
LXMXwindow_name); fi = fi + 1
}
}
for (ami in 1:length(acc.metrics)) {
# Acceleration in the form of mean, percentiles.
daysummary[di, fi] = mean(vari[WXi, acc.metrics[ami]]) * 1000
ds_names[fi] = paste0("ExtFunEvent_", WX, winhr_value, "_cad_mean_",
acc.metrics[ami], "_mg", event_suffix,
LXMXwindow_name); fi = fi + 1
if (length(params_247[["qM5L5"]]) > 0) {
for (qle in params_247[["qM5L5"]]) {
daysummary[di, fi] = quantile(x = vari[WXi, acc.metrics[ami]], probs = qle)
ds_names[fi] = paste0("ExtFunEvent_", WX, winhr_value, "_cad_q",
qle * 100, "acc", event_suffix,
LXMXwindow_name); fi = fi + 1
}
}
}
}
}
}
Expand Down
11 changes: 4 additions & 7 deletions R/g.analyse.avday.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ g.analyse.avday = function(doquan, averageday, M, IMP, t_TWDI, quantiletype,
#--------------------------------------
#M5L5 - (Note: averageday is relative to starttime of measurement, but so is firstmidnighti (index of midnights), so M5L5 are correct)
#loop through winhr
ML5N = c() # names of the M5L5 variables of the current metric
for (winhr_value in params_247[["winhr"]]) {
# Time window for L5 & M5 analysis
t0_LFMF = params_247[["L5M5window"]][1] #start in 24 hour clock hours
Expand All @@ -69,15 +70,11 @@ g.analyse.avday = function(doquan, averageday, M, IMP, t_TWDI, quantiletype,
winhr_value, qM5L5 = params_247[["qM5L5"]],
MX.ig.min.dur = params_247[["MX.ig.min.dur"]],
UnitReScale = UnitReScale)
ML5N = c(ML5N, names(ML5ADtmp))
ML5AD = as.data.frame(c(ML5AD, ML5ADtmp), stringsAsFactors = TRUE)
}
ML5N = names(ML5AD)
for (ML5ADi in 1:length(ML5N)) {
if (length(grep(pattern = "1to6", ML5N[ML5ADi])) == 0) {
ML5AD_names[ML5ADi] = paste0(ML5N[ML5ADi], "_", colnames(M$metashort)[(quani + 1)],"_mg_",
params_247[["L5M5window"]][1], "-", params_247[["L5M5window"]][2], "h")
}
}
ML5AD_names = c(ML5AD_names, paste0(ML5N, "_", colnames(M$metashort)[(quani + 1)], "_mg_",
params_247[["L5M5window"]][1], "-", params_247[["L5M5window"]][2], "h"))
# Acceleration 1-6am
one2sixname = paste0("1to6am_", colnames(M$metashort)[(quani + 1)], "_mg")
ML5AD_names = c(ML5AD_names, one2sixname)
Expand Down
4 changes: 2 additions & 2 deletions R/g.analyse.perfile.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ g.analyse.perfile = function(I, C, metrics_nav,
"filehealth_ExtSleep_y_ExtAct_missing")
filesummary[vi:(vi + 9)] = file_summary[, Fitbit_filehealth_columns]
s_names[vi:(vi + 9)] = Fitbit_filehealth_columns
vi = vi = 10
vi = vi + 10
}
#quantile, ML5, and intensity gradient variables
if (doquan == TRUE) {
Expand All @@ -175,7 +175,7 @@ g.analyse.perfile = function(I, C, metrics_nav,
# applied to the averageday per metric (except from angle metrics)
q1 = length(output_avday$igfullr)
filesummary[vi:((vi - 1) + q1)] = output_avday$igfullr
s_names[vi:((vi - 1) + q1)] = paste0(output_avday$output_avday$igfullr_names, "_fullRecording")
s_names[vi:((vi - 1) + q1)] = paste0(output_avday$igfullr_names, "_fullRecording")
vi = vi + q1
}
if (tooshort == 0) {
Expand Down
6 changes: 4 additions & 2 deletions R/g.plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,11 @@ g.plot = function(IMP, M, I, durplot) {
YTICKS = round(c(0, YLIM[2] * 1/4, YLIM[2] * 2/4, YLIM[2] * 3/4, YLIM[2]))
}
} else {
# Metric is on a g scale, convert to mg
Acceleration = Acceleration * 1000
ylabel = expression(paste("Acceleration (m", italic("g"), ")"))
YLIM = c(0, 0.6)
YTICKS = c(0, 0.2, 0.4, 0.6)
YLIM = c(0, 600)
YTICKS = c(0, 200, 400, 600)
}
plot(timeline, Acceleration, type = "l", bty = "l",
lwd = 0.1, axes = FALSE, cex.lab = 0.8,
Expand Down
Loading
Loading