Comments (14)
Looks like the last issue has nothing to do with subsetting. Also, it's really an issue with the underlying integer64
implementation:
integer64(0) > 0
## Error in if (n2%%n1) warning("length(e2) not a multiple length(e1)") :
## argument is not interpretable as logical
We also have another problem with zero length vectors, and again we just inherit the integer64
issues:
integer64(0)[TRUE]
## integer64
## [1] 9218868437227407266
instead of:
integer(0)[TRUE]
[1] NA
We might be able to fix the above issues with if statements, but it's not a very satisfactory solution.
from nanotime.
Thanks for this -- I had seen the same error message at times when I created zero-row result sets for which I requested a nanotime
column.
@lsilvest Do you have a quick idea where this may be from?
from nanotime.
format.nanotime <- function(x, format="", tz="", ...)
{
format <- .getFormat(format)
tz <- .getTz(x, tz)
bigint <- as.integer64(x)
secs <- as.integer64(bigint / as.integer64(1000000000))
nanos <- bigint - secs * as.integer64(1000000000)
res <- RcppCCTZ::formatDouble(as.double(secs), as.double(nanos), fmt=format, tgttzstr=tz)
res[is.na(x)] <- as.character(NA)
n = names(x)
if (!is.null(n)) {
names(res) <- n ## #nocov
}
res
}```
This error happens when we do binary operations on integer64 with another integer64 which is empty. In R, integer(0) / integer(1) gives numeric(0), while integer64(0) / integer64(1) gives error. This issue is creating problems at many places
from nanotime.
Yes, traceback()
lead me there too but I don't quite know yet what I want the format()
of an empty nanotime
object should be.
from nanotime.
Try the bugfix/issue35
branch I just committed -- format.nanotime()
now tests for an empty argument.
from nanotime.
This is how Date does it ...
## Scenario 1 : Empty vector in constructor
> d = character()
> as.Date(d)
[1] "Date of length 0"
## Scenario 2 : Subsetting based on empty vector of dates should also be supported
> dates = as.Date(c("2017-10-02", "2017-10-03"))
> dates[dates == as.Date("2017-10-04")]
[1] "Date of length 0"
> dates[dates == as.Date("2017-10-04")]
[1] "Date of length 0"
Does your fix support the second scenario also ?
> times = nanotime(integer64())
> times = times[times > nanotime(100) ]
> print(times)
Without your fix, at least, this case is problematic:
> times = nanotime(integer64())
> times = times[times > nanotime(100) ]
Error in callNextMethod() :
error in evaluating a 'primitive' next method: Error in if (n2%%n1) warning("length(e2) not a multiple length(e1)") :
argument is not interpretable as logical
from nanotime.
Made a second commit.
from nanotime.
The scenario 2 still fails, with bug fix !
> times = nanotime(integer64())
> times
character(0)
> times = times[times > nanotime(100) ]
Error in callNextMethod() :
error in evaluating a 'primitive' next method: Error in if (n2%%n1) warning("length(e2) not a multiple length(e1)") :
argument is not interpretable as logical
from nanotime.
Patches welcome.
from nanotime.
I am not very well versed with all the features in nanotime, as also oldClass etc keywords. I would have loved to contribute...But will take me much more time. I am taking it as a learning exercise. I had tried few things before reaching out. Few workarounds include checking for size of vector, before subsetting. But actual fix (in my opinion) should be around integer64 / RcppTz / (not sure what, though). Hope you guys can help, I will learn and then next time sure I will be able to contribute ! I will be happy to tell you test cases though, for now
from nanotime.
Maybe @lsilvest has an idea on that one; we did get two warts taken care of so some progress made.
from nanotime.
We can leave this open. Mayne we want to retitle this as it just the subsetting from integer64 that bites.
I merged the two pending branches I had -- this one and another one with two added constructor improvements.
Maybe time for a quick 0.2.1 release.
from nanotime.
I do not wish to raise issues, where people do not appreciate or welcome feedback !
from nanotime.
Can you please calm down over your non-reproducible issue #39?
This issue here was addressed over two weeks ago with this CRAN release as I mentioned.
from nanotime.
Related Issues (20)
- R-devel nags HOT 3
- Filter timestamps between times from specific time zone HOT 2
- Add/subtract methods for nanoduration/difftime durations HOT 1
- Add/subtract methods for nanotime datetimes and difftime durations HOT 1
- Add 'as.nanoduration.Duration()' HOT 5
- Issues with 'nanoival()' checks/tests HOT 7
- 'as.nanotime(NA_character_)' throws an ERROR HOT 5
- 7 out of 1256 tests failed on ppc32 HOT 5
- POSIXct -> nanotime -> POSIXct consistency HOT 13
- nanoduration divided by nanoduration should return double rather than integer64
- as.Date does not handle the case where tz is a vector HOT 5
- Could you implement comparaison on nanoduration and Character HOT 3
- Duration since yesterday's midnight in some timezone HOT 4
- nanotime 0.3.3 release HOT 2
- as.character(nanotime) returns the underlying integer HOT 4
- Export `nanoperiod` C interface for other packages to use
- Incorrect parsing for negative `nanoperiod`
- Support for abs() HOT 13
- Add to awesome-vctrs? HOT 1
- Incorrect subsetting with operator `%in%` HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nanotime.