From 75ef721c8ba6bcbf68a3ea7fd75ffe454b29fefa Mon Sep 17 00:00:00 2001 From: Vincent van Hees Date: Mon, 30 Sep 2024 19:25:20 +0200 Subject: [PATCH] add extra check on timestamp --- R/mergePHBdata.R | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/R/mergePHBdata.R b/R/mergePHBdata.R index fc802de..b091915 100644 --- a/R/mergePHBdata.R +++ b/R/mergePHBdata.R @@ -28,7 +28,15 @@ mergePHBdata = function(filenames = NULL, } if (length(file1) > 0 && length(file2) > 0) { data2$data = data2$data[, which(colnames(data2$data) != "sleepEventMarker")] - data = merge(data1$data, data2$data, by = "timestamp") + d1 = data1$data + d2 = data2$data + if (length(which(is.na(d1$timestamp) == TRUE)) > 0 || + length(which(is.na(d2$timestamp) == TRUE)) > 0) { + stop(paste0("NA values are found in the timestamps, ", + "please check parameter ", timeformatName, + " which is set to ", timeformat), call. = FALSE) + } + data = merge(d1, d2, by = "timestamp") } else { if (length(file1) > 0) { data = data1$data