From d8813e2d0470071c1902bfbb79c82ba6c764b982 Mon Sep 17 00:00:00 2001 From: JulioV Date: Tue, 9 Feb 2021 14:51:54 -0500 Subject: [PATCH] Fix bug when any of the rows from any sensor do not belong a time segment --- docs/change-log.md | 2 ++ src/data/assign_to_time_segment.R | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/change-log.md b/docs/change-log.md index 4965eaab..fb844ca3 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -1,5 +1,7 @@ # Change Log +## v0.4.3 +- Fix bug when any of the rows from any sensor do not belong a time segment ## v0.4.2 - Update battery testing - Fix location processing bug when certain columns don't exist diff --git a/src/data/assign_to_time_segment.R b/src/data/assign_to_time_segment.R index 43df1f12..90b26f37 100644 --- a/src/data/assign_to_time_segment.R +++ b/src/data/assign_to_time_segment.R @@ -29,7 +29,7 @@ get_segment_dates <- function(data, local_timezone, day_type, delay){ assign_rows_to_segments <- function(nested_data, nested_inferred_time_segments){ nested_data <- nested_data %>% mutate(assigned_segments = "") - for(i in 1:nrow(nested_inferred_time_segments)) { + for(i in seq_len(nrow(nested_inferred_time_segments))) { segment <- nested_inferred_time_segments[i,] nested_data$assigned_segments <- ifelse(segment$segment_start_ts<= nested_data$timestamp & segment$segment_end_ts >= nested_data$timestamp, stringi::stri_c(nested_data$assigned_segments, segment$segment_id, sep = "|"), nested_data$assigned_segments)