We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As of version 1.6.0, ceiling_date stopped working if the vector contains NA and unit minute, hour, or day (used to work in 1.5.6)
1.6.0
ceiling_date
NA
minute
hour
day
1.5.6
library(lubridate) dates <- c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92") times <- c("23:03:20", "22:29:56", "01:03:30", "18:21:03", "16:56:26") x <- paste(dates, times) times <- strptime(x, "%m/%d/%y %H:%M:%S") times[2] <- NA floor_date(times, unit="day") # works fine ceiling_date(times, unit="day") # breaks
Error in `[<-.POSIXlt`(`*tmp*`, not_same, value = c(699231600, NA, 695430000, : NAs are not allowed in subscripted assignments
These are the offending lines in round.R (if new or new1 contain NA):
round.R
new
new1
not_same <- new1 != new new1[not_same] <- new1[not_same] + delta
The text was updated successfully, but these errors were encountered:
Hi,
I think we could make it work changing the subsetting with:
not_same <- which(new1 != new) new1[not_same] <- new1[not_same] + delta
There is no error on subsetting this way and NA is still NA.
@vspinu, if you are ok with this fix I could make a PR adding some test.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
As of version
1.6.0
,ceiling_date
stopped working if the vector containsNA
and unitminute
,hour
, orday
(used to work in1.5.6
)These are the offending lines in
round.R
(ifnew
ornew1
containNA
):The text was updated successfully, but these errors were encountered: