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

Determine why match() tests don't work on old R #85

Closed
MichaelChirico opened this issue Oct 15, 2024 · 1 comment · Fixed by #108
Closed

Determine why match() tests don't work on old R #85

MichaelChirico opened this issue Oct 15, 2024 · 1 comment · Fixed by #108
Labels
ancient Bugs related to package support on ancient R versions bug Something isn't working
Milestone

Comments

@MichaelChirico
Copy link
Collaborator

As of #83, these tests don't pass on R 3.6.3:

expect_identical(match(2:5, y), c(NA, 1:3))
expect_identical(match(as.numeric(2:5), y), c(NA, 1:3))

No idea why at a glance. It'll require logging into an ancient Docker.

@MichaelChirico MichaelChirico added bug Something isn't working ancient Bugs related to package support on ancient R versions labels Oct 15, 2024
@MichaelChirico MichaelChirico added this to the 4.6.0 milestone Oct 21, 2024
@MichaelChirico
Copy link
Collaborator Author

This is because

  1. This is using base::match() which ignores attributes / no double dispatch
  2. Since R 4.2.0, base uses mtfrm() to pre-transform inputs to match(), defaulting to as.character(), hence why it works on recent versions of R

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ancient Bugs related to package support on ancient R versions bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant