-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
support for integer64 type in runXXX functions #134
Comments
I think the easiest way to do this would be to add Here's a helper function to test for is.integer64 <- function(x)
{
if (inherits(x, "integer64")) {
if (requireNamespace("bit64", quietly = TRUE)) {
return(TRUE)
} else {
stop("install the 'bit64' package to use this function on integer64 objects")
}
} else {
return(FALSE)
}
} Then something like this for if (is.integer64(x)) {
top <- bit64::as.integer64(rep(0, n))
csum <- cumsum(x)
result <- csum - c(top, head(csum, -n))
is.na(result) <- seq_len(n - 1 + NAs)
} |
i vaguely remember reading somewhere that supporting the bit64 types just involved adding headers and linking , but no code changes, so wasnt sure. what was actually involved. thats the only reason i left that open. for me, i ran into this because another package has loaded some data as int64 and it took me a while to track that down as the source of my issue. i fixed it by forcing the data to be loaded as a float. im not sure its worth adding the support unless someone else actually needs it. even an "int64 not currently supported." message would be pretty low priority, but i'd take that on if you want. |
I don't see any packages that currently link to data.table supports integer64, and they just check |
just looked at some internals. its a weird beast. im not sure there is value in supporting this in xts. im now more in the camp of an error message, at best > mean(bit64::as.integer64(1:10))
#integer64
#[1] 5
> mean(1L:10L)
#[1] 5.5 thinking further, most TTR and runXX functions, other than |
integer64 is weird because it's actually a The result of |
Findings:
This leaves me here:
|
Description
runXXX
functions produce incorrect results oninteger64
inputExpected behavior
would be nice if
runXXX
functions either supported int64 or generated an "unsupported" errorMinimal, reproducible example
Session Info
The text was updated successfully, but these errors were encountered: