From 3a6a4968c0d8480e1018a1215e36f52209e077de Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Fri, 4 Oct 2024 14:26:02 +0200 Subject: [PATCH 1/3] declare filename_dir before load, fixes #1208 --- R/g.part5.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/g.part5.R b/R/g.part5.R index e8f4bd692..8e1dc561b 100644 --- a/R/g.part5.R +++ b/R/g.part5.R @@ -4,6 +4,7 @@ g.part5 = function(datadir = c(), metadatadir = c(), f0=c(), f1=c(), params_cleaning = c(), params_output = c(), params_general = c(), verbose = TRUE, ...) { options(encoding = "UTF-8") + filename_dir = NULL # This function called by function GGIR # and aims to combine all the milestone output from the previous parts # in order to facilitate a varierty of analysis on time-use, interactions @@ -170,7 +171,7 @@ g.part5 = function(datadir = c(), metadatadir = c(), f0=c(), f1=c(), # convert to character/numeric if stored as factor in metashort and metalong M$metashort = correctOlderMilestoneData(M$metashort) M$metalong = correctOlderMilestoneData(M$metalong) - filename = filename_dir + filename = filename_dir # object comes from load() call above # load output g.part3 longitudinal_axis = NULL # initialise var that is part of ms3.out load(paste0(metadatadir, "/meta/ms3.out/", fnames.ms3[i])) From 9abd101c5c9ac4fbb8205342bed4a8dd11c3c641 Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Fri, 4 Oct 2024 14:28:41 +0200 Subject: [PATCH 2/3] reverse change to nonwear_range_threshold default #1172 --- NEWS.md | 2 ++ R/load_params.R | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index d8eed56f4..f4feb50e1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,6 +9,8 @@ no SIBs are detected from the beginning of the recording until the first detecte - Reports: The calendar_date and filename columns in reports have been standardized, as %Y-%m-%d and the input accelerometer file name, respectively. #1197 +- Part 1: Reverse default value for nonwear_range_threshold as changed in 3.1-3 back to 150 as more research needed to support the change. #1172 + # CHANGES IN GGIR VERSION 3.1-4 - Part 3: Update threshold used for HorAngle to 60 degree, and auto-setting HASPT.ignore.invalid to NA when NotWorn guider is used. #1186 diff --git a/R/load_params.R b/R/load_params.R index 298f443aa..7889687b8 100644 --- a/R/load_params.R +++ b/R/load_params.R @@ -61,7 +61,7 @@ load_params = function(topic = c("sleep", "metrics", "rawdata", rmc.desiredtz = NULL, rmc.configtz = NULL, rmc.sf = c(), rmc.headername.sf = c(), rmc.headername.sn = c(), rmc.headername.recordingid = c(), rmc.header.structure = c(), - rmc.check4timegaps = FALSE, rmc.noise = 13, nonwear_range_threshold = 50, + rmc.check4timegaps = FALSE, rmc.noise = 13, nonwear_range_threshold = 150, rmc.col.wear = c(), rmc.doresample = FALSE, interpolationType = 1, imputeTimegaps = TRUE, frequency_tol = 0.1, rmc.scalefactor.acc = 1) From 688a19684233d67d0ca32f902b86cf22c5387708 Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Fri, 4 Oct 2024 14:33:55 +0200 Subject: [PATCH 3/3] Update readmyacccsv.Rmd remove rmc.desiredtz and rmc.configtz from examples in the vignette as these are scheduled for deprecation, further emphasize that user should always first test their arguments with read.myacc.csv directly. --- vignettes/readmyacccsv.Rmd | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vignettes/readmyacccsv.Rmd b/vignettes/readmyacccsv.Rmd index 1f416124a..eae4f09eb 100644 --- a/vignettes/readmyacccsv.Rmd +++ b/vignettes/readmyacccsv.Rmd @@ -37,7 +37,7 @@ Internally GGIR loads csv files with accelerometer data and standardises the out # The read.myacc.csv function -As for the rest of GGIR functions, `read.myacc.csv` is intended to be used within function `GGIR`. All the arguments of the `read.myacc.csv` can be easily recognized as they all start by "rmc". The GGIR function checks whether the argument `rmc.firstrow.acc` is provided by the user; in such case, GGIR will attempt to read the data with `read.myacc.csv`. In other words you always need to specify `rmc.firstrow.acc` to use `read.myacc.csv`. +As for the rest of GGIR functions, `read.myacc.csv` is intended to be used within function `GGIR`. All the arguments of the `read.myacc.csv` can be easily recognized as they all start by "rmc". GGIR checks whether argument `rmc.firstrow.acc` is provided by the user; in such case, GGIR will attempt to read the data with function `read.myacc.csv`. In other words you always need to specify `rmc.firstrow.acc` to use `read.myacc.csv`. Further, we recommend that you always first test the function argument settings by first trying to use function `read.myacc.csv` on its own. When that works copy the arguments to you GGIR call. ## Input arguments @@ -53,8 +53,8 @@ Below we present a summary of the available input arguments. Please see the [par - `rmc.dec` - Decimal separator used for numbers, same as dec argument in \link[utils]{read.csv} and in data.table::\link[data.table]{fread}. If not "." (default) then usually ",". - `rmc.firstrow.acc` - First row (number) of the acceleration data. - `rmc.unit.acc` - Character with unit of acceleration values: "g", "mg", or "bit". -- `rmc.desiredtz` - Timezone in which device was worn. -- `rmc.confgitz` - Timezone in which device was configured. +- `desiredtz` - Timezone in which device was worn. +- `confgitz` - Timezone in which device was configured. - `rmc.sf` - Sample rate in Hertz, if this is stored in the file header then that will be used instead. ### Arguments for files containing a header {#header} @@ -112,7 +112,7 @@ dateTime | acc_x | acc_y | acc_z | ambient_temp This file contains timestamps in the column 1 (formatted as "%d/%m/%Y %H:%M:%OS"), the acceleration signals (in _g_'s) for the x, y, and z axis in the columns 2, 3, and 4, respectively, and temperature information in Celsius in the column 5. Also, this file has no header. -First, we test read this file using the `read.myacc.csv` function in GGIR as follows. +Before we can use this with GGIR, we first test read this file using the `read.myacc.csv` function directly. ```{R,eval=FALSE} library(GGIR) @@ -128,7 +128,7 @@ read.myacc.csv(rmc.file = "C:/mystudy/mydata/datafile.csv", rmc.unit.temp = "C", rmc.unit.time = "POSIX", rmc.format.time = "%d/%m/%Y %H:%M:%OS", - rmc.desiredtz = "Europe/London", + desiredtz = "Europe/London", rmc.sf = 100) ``` @@ -156,7 +156,7 @@ GGIR( rmc.unit.temp = "C", rmc.unit.time = "POSIX", rmc.format.time = "%d/%m/%Y %H:%M:%OS", - rmc.desiredtz = "Europe/London", + desiredtz = "Europe/London", rmc.sf = 100, rmc.noise = 0.013 )