With reference to the issue #156 I raised yesterday, please find below a small fix!
Within the 'determine which is home' for loop, 'xx' is the midpoint of two datetime objects. When the midpoint is calculated to be midnight, only the date is returned. This can be replicated with:
This results in 'hourofday' being NA as an hour cannot be found. By adding the suggested format wrapper, the time is maintained and 'hourofday' can be determined. It can then successfully be applied to the if-statement within the loop.
With reference to the issue #156 I raised yesterday, please find below a small fix!
Within the 'determine which is home' for loop, 'xx' is the midpoint of two datetime objects. When the midpoint is calculated to be midnight, only the date is returned. This can be replicated with:
mydates <- as.POSIXct("2018-01-01 00:00:00", tz = "UTC") mydates [1] "2018-01-01 UTC"
This results in 'hourofday' being NA as an hour cannot be found. By adding the suggested format wrapper, the time is maintained and 'hourofday' can be determined. It can then successfully be applied to the if-statement within the loop.
mydates <- format(as.POSIXct("2018-01-01 00:00:00", tz = "UTC"), "%Y-%m-%d %H:%M:%S") mydates [1] "2018-01-01 00:00:00"