-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When the time difference between 'start' and 'end' is smaller than 'time.period', the 'construct.*.ranges' functions produce wrong results. This commit fixes that and updates the documentation of those functions. This addresses #103. Signed-off-by: Thomas Bock <[email protected]>
- Loading branch information
Showing
1 changed file
with
17 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,11 @@ | |
## with this program; if not, write to the Free Software Foundation, Inc., | ||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
## | ||
## Copyright 2016-2017 by Claus Hunsen <[email protected]> | ||
## Copyright 2016-2018 by Claus Hunsen <[email protected]> | ||
## Copyright 2017 by Raphael Nömmer <[email protected]> | ||
## Copyright 2017 by Christian Hechtl <[email protected]> | ||
## Copyright 2017 by Felix Prasse <[email protected]> | ||
## Copyright 2017 by Thomas Bock <[email protected]> | ||
## Copyright 2017-2018 by Thomas Bock <[email protected]> | ||
## All Rights Reserved. | ||
|
||
|
||
|
@@ -312,6 +312,9 @@ construct.ranges = function(revs, sliding.window = FALSE, raw = FALSE) { | |
#' > ..++. | ||
#' > ....+ | ||
#' | ||
#' When the time difference between \code{start} and \code{end} is smaller than | ||
#' \code{time.period}, just one range from \code{start} to \code{end} is constructed. | ||
#' | ||
#' Important: As the start of each range is supposed to be inclusive and the end of each range | ||
#' exclusive, 1 second is added to \code{end}. This way, the date \code{end} will be *included* | ||
#' in the last range. | ||
|
@@ -347,6 +350,9 @@ construct.consecutive.ranges = function(start, end, time.period, raw = FALSE) { | |
#' overlapping ranges as in the function \code{construct.ranges} when \code{sliding.window} | ||
#' is set to \code{TRUE}. | ||
#' | ||
#' When the time difference between \code{start} and \code{end} is smaller than | ||
#' \code{time.period}, just one range from \code{start} to \code{end} is constructed. | ||
#' | ||
#' Important: As the start of each range is supposed to be inclusive and the end of each range | ||
#' exclusive, 1 second is added to \code{end}. This way, the date \code{end} will be *included* | ||
#' in the last range. | ||
|
@@ -405,7 +411,12 @@ construct.overlapping.ranges = function(start, end, time.period, overlap, raw = | |
## handle end date properly | ||
if (end.date > seq.end) { | ||
bins.number = bins.number + 1 | ||
ranges.approx = c(ranges.approx, end.date) | ||
|
||
if (seq.end == seq.start) { | ||
ranges.approx = c(seq.start, end.date) | ||
} else { | ||
ranges.approx = c(ranges.approx, end.date) | ||
} | ||
} | ||
|
||
## construct the raw ranges from the approximate ones | ||
|
@@ -448,6 +459,9 @@ construct.overlapping.ranges = function(start, end, time.period, overlap, raw = | |
#' > +++. | ||
#' > ++++ | ||
#' | ||
#' When the time difference between \code{start} and \code{end} is smaller than | ||
#' \code{time.period}, just one range from \code{start} to \code{end} is constructed. | ||
#' | ||
#' Important: As the start of each range is supposed to be inclusive and the end of each range | ||
#' exclusive, 1 second is added to \code{end}. This way, the date \code{end} will be *included* | ||
#' in the last range. | ||
|