Day Segment Analysis - Error: undefined columns selected

264 views
Skip to first unread message

Kieu Pham

unread,
Feb 14, 2024, 1:54:27 AM2/14/24
to R package GGIR

Hi all, 

I have issues processing accelerometer data for a participant using the Day Segment Analysis approach in GGIR (v3.0-5).

The data was collected using GENEActiv wrist-worn accelerometers (100Hz) under natural conditions, where participants recorded their location and corresponding time per day. The purpose of using the Day Segment Analysis approach was to include only days of interest. This is the shell code:

GGIR(

  #======================
  #GENERAL PARAMS
  #======================
  mode = mode,
  datadir = datadir,
  outputdir = outputdir,
  f0 = f0,
  f1 = f1,
  overwrite = TRUE, 
  do.imp = TRUE, 
  idloc = 2, 
  print.filename = TRUE, 
  storefolderstructure = FALSE,
  #======================
  # PART 1 
  #======================
  windowsizes = c(5, 900, 3600),
  do.cal = TRUE, 
  do.enmo = TRUE, 
  do.anglex = TRUE,
  chunksize = 0.5,
  printsummary = TRUE,
  #=====================
  #PART 2
  #=====================
  data_masking_strategy = 1, 
  hrs.del.start = 0, 
  hrs.del.end = 0, 
  maxdur = 0, 
  includedaycrit = 16,
  M5L5res = 10, 
  winhr = 5, 
  qlevels = NULL, 
  qwindow = qwindow, #file directory to the activity diary in .csv format
  qwindow_dateformat = qwindow_dateformat,
  desiredtz = "Australia/Brisbane",
  ilevels = NULL, 
  mvpathreshold = 100.6, 
  #=====================
  #PART 3  
  #=====================
  timethreshold = 10, 
  anglethreshold = 5,
  ignorenonwear = FALSE,
  #====================
  #PART 4 
  #====================
  includenightcrit = 16,
  def.noc.sleep = 1,
  loglocation = NULL,
  outliers.only = FALSE,
  criterror = 0,
  relyonguider = FALSE,
  do.visual = TRUE,
  #===================
  #PART 5
  #===================
  threshold.lig = 45.8, 
  threshold.mod = 93.2,
  threshold.vig = 418.3, 
  excludefirstlast = FALSE,
  boutcriter = 0.8, 
  boutcriter.in = 0.9,
  boutcriter.lig = 0.8,
  boutcriter.mvpa = 0.8,
  boutdur.in = c(10,20,30),
  boutdur.lig = c(1, 5, 10),
  boutdur.mvpa = c(1, 5, 10),
  timewindow = c("WW"),
  #=====================
  #REPORT 
  #=====================
  do.report=c(2,5),
  visualreport = TRUE,
  dofirstpage = TRUE,
  viewingwindow = 1

 

The code works because I successfully processed a different participant. The difference between the two are their activities. The participant that I have issues processing the accelerometer data, had additional days of recording that are not of interest, which I excluded in the activity log. An example of their activity log specified via the `qwindow()`function:


log.png


However, I receive the following error:

error.png

In the output folder, it does not contain any files relating to Part 5. In part2_daysummary.csv, there aren’t metrics computed in the file for the days of interest (highlighted in yellow below), but only the number of hours per segment:

part 2.png

 This is the quality plot:

qualityplot.png

Device Specs.png

If anyone can point out the issue or need more details please let me know! 

Regards,

Kieu


Kieu Pham

unread,
Feb 14, 2024, 7:32:34 PM2/14/24
to R package GGIR
Continuing with this thread, in case someone can jump in with suggestions. I have ran the GGIR Shell Code without the activity log (qwindow = c(0,24)). I received the following error: 

Screenshot 2024-02-15 100354.png
I am not familiar with this type of error, but I turned off the functions to generate the visual report: `do.report = c()`, `visualreport = FALSE`, `dofirstpage = FALSE`, and this worked (minus the visual report), but Part 2 and 5 summary files were in the output folder. 

To see if this was the issue, I specified the activity log again, `qwindow = C:/myactivitylog.csv` and with the visual report parameters off. This time, the GGIR Shell executed without error, however no summary reports for Part 2 and 5 were generated in the output folder. 

Note, `idloc = 2` to use the character string of the `.bin` file as the ID (the first character string preceding "_"), to match the ID in the activity log. 

If anyone has any suggestions on what to try out next, would be great! 

Lena Kushleyeva

unread,
Feb 20, 2024, 6:27:15 PM2/20/24
to R package GGIR
Kieu,

1st error you reported ("undefined columns selected") -- I've seen this error before, but unfortunately I didn't have access to the input file that caused it, so I couldn't debug it. So I'm a bit curious, and if you can share the .RData file from the meta/basic folder that corresponds to that run, I can take a look.

The 2nd error might have gotten fixed recently, but I'm not sure. Could you try installing the latest version of GGIR:

library(remotes)
remotes::install_github("wadpac/GGIR")

and trying again? If you still do get an error when running without the activity log, could you share .RData for that run as well?

-Lena

Kieu Pham

unread,
Feb 21, 2024, 5:58:46 PM2/21/24
to R package GGIR
Hi Lena, 

Thanks for responding. I have installed the latest version of GGIR as advised. I ran the shell code without the activity log and it executed without error. I ran the shell code again with the activity log and received the same error: 


Checking that user has write access permission for directory specified by argument outputdir: Yes GGIR version: 3.0.5 Do not forget to cite GGIR in your publications via a version number and Migueles et al. 2019 JMPB. doi: 10.1123/jmpb.2018-0063. See also: https://cran.r-project.org/package=GGIR/vignettes/GGIR.html#citing-ggir To make your research reproducible and interpretable always report: (1) Accelerometer brand and product name (2) How you configured the accelerometer (3) Study protocol and wear instructions given to the participants (4) GGIR version (5) How GGIR was used: Share the config.csv file or your R script. (6) How you post-processed / cleaned GGIR output (7) How reported outcomes relate to the specific variable names in GGIR _____________________________________________________________________________________________________________________________ Part 1 Checking that user has read access permission for all files in data directory: Yes 1 File name: stuart_left wrist_066987_2023-12-15 10-33-41.bin P1 file 1 Investigate calibration of the sensors with function g.calibrate: Loading chunk: 1 2 3 4 5 6 7 8 9 10 11 12 13 Summary of autocalibration procedure: Status: recalibration done, no problems detected Calibration error (g) before: 0.00744 Calibration error (g) after: 0.00262 Offset correction x: -0.000848898932656745 Offset correction y: -0.00333971016037461 Offset correction z: -0.00269655031067978 Scale correction x: 0.998516101046556 Scale correction y: 0.999426045898622 Scale correction z: 0.97109432599226 Number of hours used: 78 Number of 10 second windows around the sphere: 16889 Temperature used (if available): TRUE Temperature offset (if temperature is available) x: -0.000651854643415637 Temperature offset (if temperature is available) y: -0.00202529824092677 Temperature offset (if temperature is available) z: 0.000734026697565913 Extract signal features (metrics) with the g.getmeta function: Loading chunk: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Save .RData-file with: calibration report, file inspection report and all signal features... _____________________________________________________________________________________________________________________________ Part 2 1 _____________________________________________________________________________________________________________________________ Part 3 1 _____________________________________________________________________________________________________________________________ Part 4 1 _____________________________________________________________________________________________________________________________ Part 5 1 _____________________________________________________________________________________________________________________________ Report part 2 1Error in `[.data.frame`(df, 16:ncol(df)) : undefined columns selected

>

See attachment for the .RData for the run with activity log. If you need more information just let me know. 
meta_participant_left wrist_066987_2023-12-15 10-33-41.bin.RData

Lena Kushleyeva

unread,
Feb 22, 2024, 12:01:06 PM2/22/24
to R package GGIR
Kieu,

Thank you for re-testing the case without the activity log, and for the .RData file for the run with the activity log.
I'll take a look in the next couple of days and I'll get back to you.

-Lena

Kieu Pham

unread,
Feb 24, 2024, 6:03:43 PM2/24/24
to R package GGIR
Much appreciated Lena!

Vincent van Hees

unread,
Mar 1, 2024, 5:11:32 AM3/1/24
to Kieu Pham, R package GGIR
Kieu,

Lena prepared a fix for this, could you test it on your data and let us know if it addresses the issue for you?

To do this install GGIR with:

install.packages("remotes")
remotes::install_github("wadpac/GGIR", ref=  "issue-1010-long-daysummary")

Thanks, Vincent

--
You received this message because you are subscribed to the Google Groups "R package GGIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to RpackageGGIR...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/RpackageGGIR/1d823b04-d656-467c-976a-2c56840fdb3an%40googlegroups.com.

Vincent van Hees

unread,
Mar 1, 2024, 8:24:49 AM3/1/24
to Kieu Pham, R package GGIR
Update:
I have now ran a test with the example RData file Kieu sent in combination with attached synthetic activity logs: one with sensible timestamps and one without only dates and no data.

Both are now handled correctly by GGIR in this development branch. So, that addresses error 1.

Regarding your second error posted on February 15:
I was able to run your script both with and without activity log without errors, by which it seems that this issue has been resolved already in recent weeks.

Thanks reporting the problem and thanks Lena for looking into it,

I will now merge Lena's updates with the main GGIR branch, such that installation can be simplified to remotes::install_github("wadpac/GGIR").

I aim to make a new CRAN release in a couple of weeks.

Vincent
actlog_empty.csv
actlog.csv

Kieu Pham

unread,
Mar 5, 2024, 1:25:47 AM3/5/24
to R package GGIR
Hi Vincent, 

I ran the code and can confirm that there were no errors. Thank you and Lena for the help. 

Kieu
Reply all
Reply to author
Forward
0 new messages