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)