Skip to content

Commit

Permalink
Add mtfrm.integer64 for 4.2.x where the base default doesn't work for…
Browse files Browse the repository at this point in the history
… match(<int>, <int64>) (#112)

* Add a 4.2.0 container for debugging

* use a custom mtfrm method for 4.2.x where the default doesn't work
  • Loading branch information
MichaelChirico authored Oct 22, 2024
1 parent a64a059 commit 39dad41
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .devcontainer/r-420/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ghcr.io/r-hub/evercran/4.2.0

RUN apt-get -qq update && \
apt-get install -y --no-install-recommends git

COPY DESCRIPTION .

RUN Rscript -e ' \
install.packages("remotes"); \
remotes::install_deps(dependencies = c( \
"Depends", \
"Imports", \
"Config/needs/development" \
)) \
'
3 changes: 3 additions & 0 deletions .devcontainer/r-420/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"build": { "dockerfile": "Dockerfile", "context": "../.." }
}
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ export(unipos)
export(unipos.integer64)
export(unique.integer64)
export(xor.integer64)
if (getRversion() >= "4.2.0") S3method(mtfrm,integer64)
importFrom(bit,clone)
importFrom(bit,is.sorted)
importFrom(bit,keyorder)
Expand Down
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

1. `all.equal.integer64()` gets the same fix for vector `scale=` to work as intended that `all.equal.numeric()` got in R 4.1.3, #23.

2. Made edits to `match()` to handle `is.integer64(table)` better for older versions of R, including a new `mtfrm()` method for integer64 objects in R>=4.2.0, #85 and #111.

## NOTES

1. After creating, developing, and maintaining {bit64} for about 13 years, Jens Oehlschlägel has decided to step down as maintainer of the package. Michael Chirico will take over in this duty. Thank you Jens for creating such a wonderful & important part of the R ecosystem!
Expand Down
6 changes: 5 additions & 1 deletion R/patch64.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,15 @@ is.double.default <- function(x) base::is.double(x)
#' @export
is.double.integer64 <- function(x)FALSE

# TODO(R>=4.2.0): Remove workarounds for match(). Needed for #85 and #111.
#' @rdname bit64S3
#' @rawNamespace if (getRversion() >= "4.2.0") S3method(mtfrm,integer64)
mtfrm.integer64 = function(x) as.character(x)

match <- function(x, table, ...) UseMethod("match")
#' @rdname bit64S3
#' @export
match.default <- function(x, table, ...) {
# TODO(R>=4.2.0): Remove this workaround. Needed for #85.
if (!exists("mtfrm", baseenv()) && is.integer64(table)) base::match(as.character(x), as.character(table), ...) # nocov
else base::match(x, table, ...)
}
Expand Down
3 changes: 3 additions & 0 deletions man/bit64S3.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 39dad41

Please sign in to comment.