diff --git a/DESCRIPTION b/DESCRIPTION
index 1985dc192..23a58f03b 100755
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
Package: GGIR
Type: Package
Title: Raw Accelerometer Data Analysis
-Version: 3.1-0
-Date: 2024-05-06
+Version: 3.1-1
+Date: 2024-06-04
Authors@R: c(person("Vincent T","van Hees",role=c("aut","cre"),
email="v.vanhees@accelting.com"),
person("Jairo H","Migueles",role="aut",
diff --git a/NEWS.md b/NEWS.md
index 2b57c8d66..b99b1d540 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,7 +1,10 @@
# CHANGES IN GGIR VERSION 3.1-1
- Part 2: Corrected calculation of LXhr and MXhr which had one hour offset when timing was after midnight, #1117
-- Fixes reversion of reading `.csv.gz` files #1131.
+
+- Part 1: Fixes reversion of reading `.csv.gz` files #1131.
+
+- Loading GGIR: Stops interactive calling of `chooseCRANmirror` on `.onAttach` if interactive and CRAN mirror not set #1141.
- Part 4: Corrected documentation for parameter relyonguider.
@@ -9,6 +12,10 @@
- Visualreport: Improve handling of recordings where the accelerometer was not worn.
+- Part 4: Ignore empty sleeplog columns, which are sometimes accidentally created the user. GGIR can now handle these. #1138
+
+- Part 4 report: Bug fixed causing night_part4 column to not be used #1142.
+
- Part 5: Fix incorrect calendar date when window starts 5 seconds before midnight, #1082
# CHANGES IN GGIR VERSION 3.1-0
diff --git a/R/g.loadlog.R b/R/g.loadlog.R
index d1750c0c0..da6c1c72c 100644
--- a/R/g.loadlog.R
+++ b/R/g.loadlog.R
@@ -7,6 +7,7 @@ g.loadlog = function(loglocation = c(), coln1 = c(), colid = c(),
# Load sleep log data...
S = data.table::fread(file = loglocation, stringsAsFactors = FALSE, data.table = FALSE,
check.names = TRUE, colClasses = "character")
+ S = Filter(function(x)!all(x == ""), S) # remove empty columns
nnights = (ncol(S) - coln1 + 1) / 2
cnt_time_notrecognise = 0
advanced_sleeplog = length(grep(pattern = "date", x = colnames(S), ignore.case = TRUE)) > 0
@@ -216,7 +217,7 @@ g.loadlog = function(loglocation = c(), coln1 = c(), colid = c(),
warning(paste0("\nWe see an odd number of timestamp columns",
" in the sleeplog. The last column will be ignored. If this is incorrect,",
" please check that argument coln1 is correctly specified if you use a basic sleeplog format and",
- " that all days have a date column if you use an advanced sleeplog format."))
+ " that all days have a date column if you use an advanced sleeplog format."), call. = FALSE)
nnights = floor(nnights)
}
nnights = nnights + deltadate + 1 # to account for the possibility of extra night at the beginning of recording
diff --git a/R/g.report.part4.R b/R/g.report.part4.R
index 543547782..290c52341 100644
--- a/R/g.report.part4.R
+++ b/R/g.report.part4.R
@@ -194,6 +194,9 @@ g.report.part4 = function(datadir = c(), metadatadir = c(), loglocation = c(),
if (length(data_cleaning_file) > 0) {
DaCleanFile = data.table::fread(data_cleaning_file, data.table = FALSE)
if ("night_part4" %in% colnames(DaCleanFile)) {
+ if (inherits(x = nightsummary$night, "character")) {
+ nightsummary$night = as.numeric(gsub(pattern = " ", replacement = "", x = nightsummary$night))
+ }
days2exclude = which(nightsummary$ID %in% DaCleanFile$ID & nightsummary$night %in% DaCleanFile$night_part4)
if (length(days2exclude) == 0 & inherits(x = nightsummary$ID, "character")) {
# Try again by now attempt to read ID as numeric
diff --git a/R/zzz.R b/R/zzz.R
index bb6d2b261..57af7fbb6 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -1,6 +1,17 @@
.onAttach <- function(...) {
if (!interactive()) return()
- pkgs <- available.packages()
+ # stop interactive calling from `library(GGIR)`
+ repos = getOption("repos")
+ if ("@CRAN@" %in% repos) {
+ repos = utils::getCRANmirrors()
+ # choose cloud/first if option triggers `contrib.url`
+ # to call `chooseCRANmirror`
+ repos = repos$URL[1]
+ packageStartupMessage(
+ "No CRAN mirror set, so using ", repos,
+ " to check GGIR package version")
+ }
+ pkgs <- available.packages(repos = repos)
cran_version <- package_version(pkgs[which(pkgs[,1] == "GGIR"),"Version"])
local_version <- packageVersion("GGIR")
behind_cran <- cran_version > local_version
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 71e2de207..7f7521937 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -83,7 +83,10 @@ navbar:
right: [search, github, twitter]
news:
+ cran_dates: TRUE
releases:
+ - text: "Version 3.1-0"
+ href: https://www.accelting.com/updates/ggir-release-3-1-0/
- text: "Version 3.0-0"
href: https://www.accelting.com/updates/ggir-release-3-0-0/
- text: "Version 2.9-0"
diff --git a/docs/404.html b/docs/404.html
index e4be35393..36fa5be18 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -27,7 +27,7 @@
GGIR
- 3.1-0
+ 3.1-1