Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upComparing 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.tablea 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.tablethis 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