Skip to content

Commit

Permalink
Merge pull request #1209 from wadpac/issue1208_NOTE
Browse files Browse the repository at this point in the history
Small changes
  • Loading branch information
vincentvanhees authored Oct 4, 2024
2 parents 7a402c7 + 688a196 commit 0e98108
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion R/g.part5.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]))
Expand Down
2 changes: 1 addition & 1 deletion R/load_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions vignettes/readmyacccsv.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}
Expand Down Expand Up @@ -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)
Expand All @@ -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)
```

Expand Down Expand Up @@ -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
)
Expand Down

0 comments on commit 0e98108

Please sign in to comment.