Fix bug in assign date segment when file is empty

pull/103/head
JulioV 2020-09-30 14:53:59 -04:00
parent 2a752b6aa7
commit c0c32d9f9e
1 changed files with 3 additions and 0 deletions

View File

@ -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){ 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 if(day_segments_type == "FREQUENCY"){ #FREQUENCY
day_segments <- day_segments %>% mutate(start_time = lubridate::hm(start_time), day_segments <- day_segments %>% mutate(start_time = lubridate::hm(start_time),