Skip to content

Commit

Permalink
add extra check on timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentvanhees committed Sep 30, 2024
1 parent 3a3d588 commit 75ef721
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion R/mergePHBdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 75ef721

Please sign in to comment.