Skip to content
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

setdiff does not seem to like integer64 class vectors #29

Open
aaronw22 opened this issue Aug 10, 2023 · 3 comments
Open

setdiff does not seem to like integer64 class vectors #29

aaronw22 opened this issue Aug 10, 2023 · 3 comments

Comments

@aaronw22
Copy link

A trivial example:

> setdiff(bit64::as.integer64(c(1, 2, 3)), bit64::as.integer64(c(1, 2)))
[1] 1.482197e-323

> # Expected result
> setdiff(c(1L, 2L, 3L), c(1L, 2L))
[1] 3

My sessionInfo()

R version 4.3.0 (2023-04-21 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default


locale:
[1] LC_COLLATE=English_Australia.utf8  LC_CTYPE=English_Australia.utf8    LC_MONETARY=English_Australia.utf8 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.utf8    

time zone: Australia/Sydney
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] bit64_4.0.5 bit_4.0.5  

loaded via a namespace (and not attached):
[1] compiler_4.3.0    tools_4.3.0       rstudioapi_0.15.0

@psychelzh
Copy link

psychelzh commented Jan 21, 2024

Currently, there is only match.integer64(). As users, we need to write our own set operations for bit64.

@aaronw22
Copy link
Author

aaronw22 commented Feb 2, 2024

Makes sense, so it is a missing method issue rather than a bug.

@truecluster
Copy link
Contributor

truecluster commented Aug 24, 2024

Explanation: if setdiff was a generic, we could write a method for integer64. But it would dispatch only on the first argument, not on the second (like match does). Current setdiff uses as.vector, but CRAN maintainers forbid a as.vector.integer64 that keeps the integer64 class attribute. We would need cooperation of CRAN maintainers to either make setdiff generic or to add special handling for integer64 to setdiff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants