Skip to content

Commit

Permalink
Merge pull request #1 from xvrdm/xvrdm-round_date-patch-1
Browse files Browse the repository at this point in the history
Make round_date() really use week_start=
  • Loading branch information
xvrdm authored Nov 27, 2018
2 parents f5b92c3 + fe5f869 commit 14cd27a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/round.r
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ round_date <- function(x, unit = "second", week_start = getOption("lubridate.wee
## special case for fast rounding
round.POSIXt(x, units = lub2base_units[[basic_unit]])
} else {
above <- unclass(as.POSIXct(ceiling_date(x, unit)))
above <- unclass(as.POSIXct(ceiling_date(x, unit, week_start)))
mid <- unclass(as.POSIXct(x))
below <- unclass(as.POSIXct(floor_date(x, unit)))
below <- unclass(as.POSIXct(floor_date(x, unit, week_start)))
wabove <- (above - mid) <= (mid - below)
wabove <- !is.na(wabove) & wabove
new <- below
Expand Down

0 comments on commit 14cd27a

Please sign in to comment.