-
Notifications
You must be signed in to change notification settings - Fork 978
New issue
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
IDate should not convert to Date when met with integers #1528
Comments
Made progress on this but I can't seem to get the method to export properly. See this branch. Any suggestions? I'm at a loss. |
Looks like extra backtick in namespace file, easy visible when compare to master
|
oh, thanks! vestige from when I was trying to add it to exports.
|
Closes #1528, adds S3 method for `+.IDate`
…eck.attributes=FALSE to ignore column name differences. #1528
Hi, I'm having some difficulties with the current > d <- "2015-01-01"
> as.IDate(d) - 1.5
Error in as.Date.numeric(e2) : 'origin' must be supplied because of forced coercion to Date. At the same time > str(as.Date(d) - 1.5)
Date[1:1], format: "2014-12-30" Might I suggest modifying the forced coercion to Date return(`-.Date`(as.Date(e1),as.Date(e2))) to just return(`-.Date`(as.Date(e1), e2)) ? Then, > str(as.IDate(d) - as.IDate(d))
int 0
> str(as.IDate(d) - 1L)
IDate[1:1], format: "2014-12-31"
> str(as.IDate(d) - as.Date(d))
IDate[1:1], format: "1970-01-01"
Warning message:
In str(as.IDate(d) - as.Date(d)) :
Incompatible methods ("-.IDate", "-.Date") for "-"
> str(as.IDate(d) - 1.0)
Date[1:1], format: "2014-12-31" Side note: the warning message should perhaps not be a problem, since e.g. > str(as.Date(d) - as.IDate(d))
Date[1:1], format: "1970-01-01"
Warning message:
In str(as.Date(d) - as.IDate(d)) :
Incompatible methods ("-.Date", "-.IDate") for "-" and I at least would expect |
Would you mind quickly trying it from my branch which has a different implementation of |
You appear to have included > d <- "2015-01-01"
> str(as.IDate(d) - as.IDate(d))
Class 'difftime' atomic [1:1] 0
..- attr(*, "units")= chr "days"
> str(as.IDate(d) - 1L)
IDate[1:1], format: "2014-12-31"
> str(as.IDate(d) - as.Date(d))
IDate[1:1], format: "1970-01-01"
Warning message:
In str(as.IDate(d) - as.Date(d)) :
Incompatible methods ("-.IDate", "-.Date") for "-"
> str(as.IDate(d) - 1.0)
IDate[1:1], format: "2014-12-31"
> str(as.IDate(d) - as.date(1))
IDate[1:1], format: "2014-12-31"
Warning message:
In str(as.IDate(d) - as.date(1)) :
Incompatible methods ("-.IDate", "Ops.date") for "-"
> diff <- as.Date(d) - (as.Date(d) - 10)
> str(as.IDate(d) - diff)
IDate[1:1], format: "2014-12-22"
Warning message:
In str(as.IDate(d) - diff) :
Incompatible methods ("-.IDate", "Ops.difftime") for "-" |
There's a discrepancy between
Date
andIDate
w.r.t. interacting with non-IDate
objects, namely:Is this intentional?
For reference, here is the
+.Date
method:The text was updated successfully, but these errors were encountered: