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
We see there's a lot of minor stuff to take care of to get IDate on par with Date for built in methods (and to help make sure we're not accidentally converting to Date along the way).
Specifically, we can add the following:
as.character
as.data.frame
as.data.table
as.POSIXlt
Axis
-
[<-
[
[[
diff
format
hist
is.numeric
julian
Math
mean
months
Ops
pretty
print
quarters
split
str
summary
Summary
trunc
weekdays
weighted.mean
xtfrm
The text was updated successfully, but these errors were encountered:
Was about to post a new issue (titled "replace() returns invalid IDates") before I saw this. There are good reasons for at least some of these besides efficiency, I guess.
Here's an example for [<-.IDate:
library(data.table)
z = replace(as.IDate(Sys.Date() + 1:2), 1L, as.IDate(Sys.Date()-1L))
dput(z)
# structure(c(17189, 17192), class = c("IDate", "Date"))
As you can see, the storage format of the vector is not integer and yet the class still claims to be IDate.
This was a problem for me because I stored this vector as a column alongside a legit IDate and then used melt, which correctly gave me the warning
'measure.vars' [z, d] are not all of the same type. [...]
and gave me back an unclassed double.
Maybe the problem is that replace uses [<-, and that gets dispatched to [<-.Date which contains a pernicious as.Date(value) line, so maybe a dedicated [<-.IDate.
Comparing
With
We see there's a lot of minor stuff to take care of to get
IDate
on par withDate
for built in methods (and to help make sure we're not accidentally converting toDate
along the way).Specifically, we can add the following:
The text was updated successfully, but these errors were encountered: