-
Notifications
You must be signed in to change notification settings - Fork 6
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
Comparing nanotime with a character #52
Comments
Well, first off your example doen't work (without the timezone argument expected by the parser). Second, a naive attempt of defining |
This seems to work: modified R/nanotime.R +##' @rdname nanotime
+##' @export
+setMethod("Compare", c("nanotime", "character"),
+ function(e1, e2) {
+ ne2 <- nanotime(e2)
+ callNextMethod(e1, ne2)
+ })
+
##' @rdname nanotime
##' @export
setMethod("Compare", c("nanotime", "ANY"), Thoughts, @lsilvest ? |
That should work, and also it would make sense I think to define it for |
Done in 75eec4c. Appears to upset one unit test which I should have checked earlier already. Example: R> library(nanotime)
R> "2018-12-28T16:34:59.649943448+00:00" < nanotime("2018-12-28T16:34:59.000000000+00:00")
[1] FALSE
R> "2018-12-28T16:34:59.649943448+00:00" > nanotime("2018-12-28T16:34:59.000000000+00:00")
[1] TRUE
R> Good S4 benefit to be able to do it both ways. |
That was in my .Rprofile sorry, edited the initial question |
Ok, this should be taken care of in #54. |
Hello, I am using nanotime in conjuction with
data.table
a lot now and I would have thought being able to compare nanotime with character would be good syntactic suggar.I mean
would be equivalent to
I
data.table
this get very appreciable I think and this links well with #51I am happy to try to do a PR but wanted to check first that I am not missing something and/or/hence the PR would be rejected
The text was updated successfully, but these errors were encountered: