Skip to content

Commit 3a2e1d0

Browse files
committed
minor update of code to make it easier to read
1 parent 5daad7c commit 3a2e1d0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/aggregate_per_date.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ aggregate_per_date = function(tsDir, epoch, classifier, classes,
113113
if (is.na(next_noon)) {
114114
# if there is not a next_noon, meaning that recording finished before 12pm
115115
# following the last wake up
116-
start_end_nighttime_dates[ni] = as.character(as.Date(ts$date[noons[length(noons)]]) + 1)
116+
prev_noon = max(which(noons < start_end_nighttime$ends[ni]))
117+
start_end_nighttime_dates[ni] = as.character(as.Date(ts$date[noons[prev_noon]]) + 1)
117118
} else {
118119
start_end_nighttime_dates[ni] = ts$date[noons[next_noon]]
119120
}

0 commit comments

Comments
 (0)