Skip to content

Commit

Permalink
[Fix #338] Document behavior or round_date for halfway values
Browse files Browse the repository at this point in the history
  • Loading branch information
vspinu committed Oct 4, 2015
1 parent e710ce4 commit 9dfc087
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/round.r
Expand Up @@ -4,7 +4,12 @@
#' week, month, quarter, or year.
#'
#' \code{round_date} takes a date-time object and rounds it to the nearest
#' integer value of the specified time unit.
#' integer value of the specified time unit. For rounding date-ties which is
#' exactly halfway between two consecutive units, the convention is to round
#' up. Note that this is in line with the behavior of R's base
#' \link[base]{round.POSIXt} function but does not follow the convention of the
#' base \link[base]{round} function which "goes to the even digit" per IEC
#' 60559.
#'
#' \code{floor_date} takes a date-time object and rounds it down to the nearest integer
#' value of the specified time unit.
Expand All @@ -20,6 +25,7 @@
#' "second", "minute", "hour", "day", "week", "month", "quarter", or "year."
#' @return x with the appropriate units floored
#' @keywords manip chron
#' @seealso \link[base]{round}
#' @examples
#' x <- as.POSIXct("2009-08-03 12:01:59.23")
#' round_date(x, "second")
Expand Down

0 comments on commit 9dfc087

Please sign in to comment.