From c0c32d9f9e14f225b9ff7d32925aab98650df7da Mon Sep 17 00:00:00 2001 From: JulioV Date: Wed, 30 Sep 2020 14:53:59 -0400 Subject: [PATCH] Fix bug in assign date segment when file is empty --- src/data/assign_to_day_segment.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/data/assign_to_day_segment.R b/src/data/assign_to_day_segment.R index 67e18b5c..02a046ba 100644 --- a/src/data/assign_to_day_segment.R +++ b/src/data/assign_to_day_segment.R @@ -31,6 +31,9 @@ find_segments_event <- function(timestamp, segments){ assign_to_day_segment <- function(sensor_data, day_segments, day_segments_type, include_past_periodic_segments){ + if(nrow(sensor_data) == 0) + return(sensor_data %>% mutate(assigned_segments = NA)) + if(day_segments_type == "FREQUENCY"){ #FREQUENCY day_segments <- day_segments %>% mutate(start_time = lubridate::hm(start_time),