How do I modify the part 4 of G.Shell.GGIR function in R if I do not have a sleep log

81 views
Skip to first unread message

Hadiza Ismaila

unread,
Sep 28, 2018, 3:53:53 PM9/28/18
to R package GGIR

I am trying to analyse physical activity data collected from geneactiv accelerometer using the GGIR shell function in R (code copied from Accelerometer data processing with GGIR document). The Part 4 section of the code requires comparing the sleep data generated by the accelerometer and a self-reported sleep log. The "loglocation" argument requires you to enter the CSV filename for the manual sleep log. However my study does not include the self-reported sleep log as I am mainly interested in physical activity levels not sleep analysis. How do I modify the code to exclude including the sleep log and get my code to run successfully and produce the necessary visual data? Please find below the R code for physical activity analysis. 

    
    library(GGIR)
    g.shell.GGIR(#=======================================
                 # INPUT NEEDED:
                 mode=c(1,2,3,4,5),
                 datadir="C:/Hadiza/Documents/GENEACTIV/PAanalysis",
                 outputdir="C:/Hadiza/Documents/GENEACTIV/PAresults",
                 f0=1, f1=2,
                 #-------------------------------
                 # Part 1:
                 #-------------------------------
                 # Key functions: reading file, auto-calibration, and extracting features
                 do.enmo = TRUE,             do.anglez=TRUE,
                 chunksize=1,                printsummary=TRUE,
                 #-------------------------------
                 # Part 2:
                 #-------------------------------
                 strategy = 2,               ndayswindow=7,
                 hrs.del.start = 0,          hrs.del.end = 0,
                 maxdur = 9,                 includedaycrit = 16,
                 winhr = c(5,10),
                 qlevels = c(c(1380/1440),c(1410/1440)),
                 qwindow=c(0,24),
                 ilevels = c(seq(0,400,by=50),8000),
                 mvpathreshold =c(100,120),
                 bout.metric = 4,
                 closedbout=FALSE,
                 #-------------------------------
                 # Part 3:
                 #-------------------------------
                 # Key functions: Sleep detection
                 timethreshold= c(5),        anglethreshold=5,
                 ignorenonwear = TRUE,
                 #-------------------------------
                 # Part 4:
                 #-------------------------------
                 # Key functions: Integrating sleep log (if available) with sleep detection
                 # storing day and person specific summaries of sleep
                 excludefirstlast = TRUE,
                 includenightcrit = 16,
                 def.noc.sleep = c(),
                 loglocation= "C:/mydata/sleeplog.csv",
                 outliers.only = TRUE,
                 criterror = 4,
                 relyonsleeplog = FALSE,
                 sleeplogidnum = TRUE,
                 colid=1,
                 coln1=2,
                 do.visual = TRUE,
                 nnights = 9,
                 #-------------------------------
                 # Part 5:
                 # Key functions: Merging physical activity with sleep analyses
                 #-------------------------------
                 threshold.lig = c(30), threshold.mod = c(100),  threshold.vig = c(400),
                 boutcriter = 0.8,      boutcriter.in = 0.9,     boutcriter.lig = 0.8,
                 boutcriter.mvpa = 0.8, boutdur.in = c(1,10,30), boutdur.lig = c(1,10),
                 boutdur.mvpa = c(1),   timewindow = c("WW"),
                 #-----------------------------------
                 # Report generation
                 #-------------------------------
                 # Key functions: Generating reports based on meta-data
                 do.report=c(2,4,5),
                 visualreport=TRUE,     dofirstpage = TRUE,
                 viewingwindow=1)

Bernhard Novak

unread,
Sep 29, 2018, 11:52:41 AM9/29/18
to R package GGIR
Hi,

if no sleeplog is available change it to: loglocation= c(),

Best wishes,
Bernhard

Hadiza Ismaila

unread,
Sep 29, 2018, 1:26:23 PM9/29/18
to R package GGIR
Thank you Bernhard,

I did just that and I am now getting the error message in part 4: Error in spocum.t[,3] : incorrect number of dimensions. Do you please know the reason for this? Thanks.

Bernhard Novak

unread,
Sep 29, 2018, 1:56:33 PM9/29/18
to R package GGIR
Dear Hadiza Ismaila,

i never had this Error by myself - but see this link: https://groups.google.com/d/msg/RpackageGGIR/flxCMk3BUd4/lt0Yu2rtBAAJ
What is the version of your package? - the latest package would be 1.6-7 - maybe an update will help. 
If you are using RStudio click on "Packages" - choose "GGIR" and "Install Update".

Best regards,
Bernhard

Hadiza Ismaila

unread,
Sep 30, 2018, 8:01:28 AM9/30/18
to R package GGIR
Thank you again Bernhard,

Updating the package solved the problem for me, however I am now getting another error message in Generate visual report:
Error in `[.data.frame`(daysummary_tmp, , MainMetric): Object 'MainMetric' not found... Have you encountered this before? Thanks.

Bernhard Novak

unread,
Oct 3, 2018, 3:31:22 AM10/3/18
to R package GGIR
Hi,

Never had this one before - sorry.

Vincent van Hees

unread,
Oct 6, 2018, 6:00:16 AM10/6/18
to novak.b...@gmail.com, R package GGIR
Hi Hadiza,
Does results/part2_daysummary.csv include one of the following variable names: mean_ENMO_mg_24hr , mean_ENMO_mg_0-24hr , or mean_ENMO_mg_0.24hr?
If not then that may explain it: Reprocess your data (argument overwrite = TRUE).
If you do not have a results/part2_daysummary.csv file then you may not have run part2 and generated the corresponding report yet.
Further, you may want to check that csv-reports generated for part2 and part4 include data for at least a few days of measurement.
Best, 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 post to this group, send email to Rpacka...@googlegroups.com.
Visit this group at https://groups.google.com/group/RpackageGGIR.
To view this discussion on the web, visit https://groups.google.com/d/msgid/RpackageGGIR/9f9583eb-174d-440b-98da-8de112c7d99d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joseph Pleso

unread,
Jun 5, 2019, 11:25:16 AM6/5/19
to R package GGIR
I also get the same "MainMetric" error. It is blocking the output of the pdfs.

I get this from a simple run of all 5 parts against 

123A_testaccfile.csv


with about 2 days of sample data at 3Hz

Vincent van Hees

unread,
Jun 24, 2019, 10:48:57 AM6/24/19
to Joseph Pleso, Bernhard Novak, hadiza....@gmail.com, R package GGIR
I can look at this after I am back from ICAMPAM conference.

Please can someone post here a reproducible example of the error? That would help me with investigating it.
A reproducible example would require both example data (raw or milestone data produced by GGIR) and your R code.
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 post to this group, send email to Rpacka...@googlegroups.com.
Visit this group at https://groups.google.com/group/RpackageGGIR.

Nishat Akhtar

unread,
Oct 7, 2020, 3:17:45 PM10/7/20
to R package GGIR
Please resolve this issue.

Vincent van Hees

unread,
Oct 8, 2020, 3:07:27 PM10/8/20
to Nishat Akhtar, R package GGIR
GGIR is open source software. Demanding fixes to a problems is not the way to go. 

As I wrote in my previous message, please post a detailed description of the issue with a minimal reproducible example. If you want me to work on this with priority and can pay me for my time then please contact me.

Best regards,

Vincent

Dr. Vincent van Hees
Independent consultant

ACCELTING.png



‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

Reply all
Reply to author
Forward
0 new messages