Permalink
Browse files

Changed round_date to handle input of length zero

  • Loading branch information...
1 parent a73c56c commit 93875311e9cfb4c5a0613df56d9e88c93fab2f3e @garrettgman garrettgman committed Nov 14, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 R/round.r
View
@@ -129,6 +129,9 @@ ceiling_date <- function(x, unit = c("second","minute","hour","day", "week", "mo
#' round_date(x, "year")
#' # "2010-01-01 CST"
round_date <- function(x, unit = c("second","minute","hour","day", "week", "month", "year")) {
+
+ if(!length(x)) return(x)
+
unit <- match.arg(unit)
below <- as.POSIXct(floor_date(x, unit))

0 comments on commit 9387531

Please sign in to comment.