Data merging

197 views
Skip to first unread message

nury amar

unread,
Jul 4, 2022, 1:21:53 PM7/4/22
to R package GGIR
Hi everyone,
I'm a beginner in accelerometer data analysis and trying to solve the problem of data merging.
We used Actigraph GT3X-BT for 21 days data collection. Due to a force majeure factor (data memory), we performed data collection again after exporting the data on day 7.
Using AGD files can merge files of two time periods (part1 and part3), but GGIR cannot read files in AGD format.
In order to solve this problem, we converted the gt3x file to csv. And according to what we know about the intermediate blank time, a csv (part2) file is created artificially. And then the three csv files are merged (part1 + part2 + part3). The file runs smoothly in GGIR, but the timing is not recognized as we planned.
We want to know how the GGIR package identifies the Start Time when reading the csv file? 
Is it Start Time in the first 10 lines of information? If the time of part1 and part2 overlap, can part2 cover part1?
We boldly tried a solution, but we don't know if this is the right way? If it is wrong, can you point out our mistakes?
Finally, We would like to konw, is there a  way in GGIR to solve the problem of merging gt3x files?

Please forgive me if I ask any stupid question.


Thanks,
Nury



My code:  

library(GGIR)
GGIR(
  rmc.firstrow.header=c(11),
  rmc.header.length = c(),
  rmc.col.acc = 2:4, rmc.col.temp = c(),
  rmc.col.time= c(1),
  rmc.unit.acc = "g", rmc.unit.temp = "C",
  rmc.unit.time = "POSIX",
  rmc.format.time = "%Y-%m-%d %H:%M:%OS",
  rmc.bitrate = c(), rmc.dynamic_range = c(),
  rmc.unsignedbit = TRUE,
  rmc.origin = "1970-01-01",
  rmc.desiredtz = "Asia/Shanghai",
  rmc.sf = 30,
  rmc.headername.sf = c(),
  rmc.headername.sn = c(),
  rmc.headername.recordingid = c(),          
  rmc.header.structure = c(),
  rmc.check4timegaps = FALSE,
  rmc.col.wear = c(),
  rmc.doresample=FALSE,
  interpolationType=1,
  mode = c(1,2,3,4,5),
  datadir = "/Users/mydata",
  outputdir = "/Users/myresults",
  f0 = 1,
  f1 = 2,
  #-------------------------------
  # Part 1 parameters:
  #-------------------------------
  windowsizes = c(5,900,3600),
  do.cal=TRUE,
  do.enmo = TRUE,
  do.anglez=TRUE,
  chunksize=1,
  printsummary=TRUE,
  #-------------------------------
  # Part 2 parameters:
  #-------------------------------
  strategy = 2,
  hrs.del.start = 0,
  hrs.del.end = 0,
  maxdur = 21,
  includedaycrit = 10,
  qwindow=c(0,8,21,24),
  mvpathreshold =c(100),
  bout.metric = 5,
  #-------------------------------
  # Part 3 parameters:
  #-------------------------------
  timethreshold= c(5),
  anglethreshold=5,
  ignorenonwear = TRUE,
  do.part3.pdf=TRUE,
  #-------------------------------
  # Part 4 parameters:
  #-------------------------------
  excludefirstlast = FALSE,
  includenightcrit = 10,
  def.noc.sleep = 1,
  #loglocation= "/Users/shuwen/myresults/sleeplog.csv",
  outliers.only = FALSE,
  criterror = 4,
  relyonsleeplog = FALSE,
  sleeplogidnum = FALSE,
  colid=1,
  coln1=2,
  do.visual = TRUE,
  nnights = 21,
  #-------------------------------
  # Part 5 parameters:
  #-------------------------------
  # Key functions: Merging physical activity with sleep analyses
  do.ENMO = TRUE,
  acc.metric="ENMO",
  threshold.lig = c(30),
  threshold.mod = c(100),
  threshold.vig = c(400),
  excludefirstlast = FALSE,
  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"),
  includedaycrit.part5 = 2/3,
  #-----------------------------------
  # Report generation
  #-------------------------------
  visualreport=TRUE,
  dofirstpage=TRUE
)

Vincent van Hees

unread,
Jul 15, 2022, 4:31:34 AM7/15/22
to nury amar, R package GGIR
Hi Nury,

We want to know how the GGIR package identifies the Start Time when reading the csv file? 

GGIR uses the first timestamp and then assumes that time during the rest of the recording can be derived from the sampling frequency. For some brands (Axivity) and optionally with the ad-hoc csv file by setting rmc.doresample=TRUE. we interpolate (resample) the data points to have consistent sample frequency. So, what you are probably missing is in your effort to append the csv files is a step to omit overlapping timestamps (if this applies). Als you may want to set  rmc.check4timegaps = TRUE which fills in the time gaps.

Finally, We would like to konw, is there a  way in GGIR to solve the problem of merging gt3x files?

GGIR does not facilitate merging gt3x files. You could try ask the Actigraph company.

Please forgive me if I ask any stupid question.

Questions are never stupid. It is good for GGIR if everyone posts their questions/challenges here such that we can all learn from them.

Thanks,
Vincent

Dr. Vincent van Hees | Independent consultant | https://accelting.com/
image

------- Original Message -------
--
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/18104fe5-38fc-4320-bcf7-92595e67c2d2n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages