diff --git a/tests/test-split-network-time-based.R b/tests/test-split-network-time-based.R index 18b4be51..c878d4cb 100644 --- a/tests/test-split-network-time-based.R +++ b/tests/test-split-network-time-based.R @@ -206,7 +206,8 @@ patrick::with_parameters_test_that("Split a network time-based (time.period = .. expected.bins = get.date.from.string(c("2016-07-12 15:58:59", "2016-07-12 15:59:59", "2016-07-12 16:00:59", "2016-07-12 16:01:59", "2016-07-12 16:02:59", "2016-07-12 16:03:59", - "2016-07-12 16:04:59", "2016-07-12 16:06:33")) + "2016-07-12 16:04:59", "2016-07-12 16:05:59", + "2016-07-12 16:06:33")) expect_equal(expected.bins, attr(results, "bins")) ## check networks diff --git a/util-split.R b/util-split.R index 928ad5bb..cdbf00bf 100644 --- a/util-split.R +++ b/util-split.R @@ -815,11 +815,9 @@ split.network.time.based.by.ranges = function(network, ranges, remove.isolates = ) ## convert ranges to bins - bins.starts = sapply(ranges.bounds, function(range) range[1]) - bins.end = ranges.bounds[[length(ranges.bounds)]][2] - bins.date = get.date.from.unix.timestamp(c(bins.starts, bins.end)) + bins = get.bin.dates.from.ranges(ranges.bounds) + attr(nets.split, "bins") = bins - attr(nets.split, "bins") = bins.date return(nets.split) }