You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dat <- data.frame(a = c(as.POSIXct(as.Date("2006-12-12")), as.POSIXct(as.Date("2005-01-05"))))
dat$b <- dat$a + 1
use_first_valid_of(dat$a, dat$b)
[1] 1165881600 1104883200
Warning messages:
1: In if (class(vars[[1]]) == "factor") { :
the condition has length > 1 and only the first element will be used
2: In if (class(vars[[1]]) == "Date") { :
the condition has length > 1 and only the first element will be used
Right now it sets the result vector to class Date if inputs are Date which is insufficient. Can it just set to whatever the resulting class should be?
The text was updated successfully, but these errors were encountered:
That error message indicates a separate problem: some variables have multiple classes, like POSIXct and POSIXt, so saying class(x) == "factor" causes that error message above. Will also address that here by making the condition if(sum(class(vars[[1]]) %in% "factor") > 0).
Ended up being a trickier fix than I thought. It didn't occur to me that POSIXlt is a list, not a vector, so it wasn't stored correctly in the nested for-loops and I was getting the not-helpful message $ operator is invalid for atomic vectors. Good thing I wrote POSIXlt unit tests when I wrote the POSIXct ones that covered my immediate problem :)
Right now it sets the result vector to class
Date
if inputs areDate
which is insufficient. Can it just set to whatever the resulting class should be?The text was updated successfully, but these errors were encountered: