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

"Replace is not a multiple of replacement length" warning in is_installed() and check_installed() #1694

Open
ddsjoberg opened this issue Mar 3, 2024 · 0 comments

Comments

@ddsjoberg
Copy link

ddsjoberg commented Mar 3, 2024

Hello! I am using is_installed() and check_installed() in a pkg and they are great, thank you!

I noticed in the case where you want to check multiple packages AND you specify both version and compare arguments AND there is a mix of versions to check and no version to check, you get an unexpected warning. (A bit of an edge edge case.)

Example below! If you'd like, I can investigate and submit a PR. But I know sometimes it's just easier to update as the maintainer 😝

Thank you!

packageVersion("rlang")
#> [1] '1.1.3'

# throws a warning unexpectedly
rlang::is_installed(
  pkg = c("dplyr", "tidyr"),
  version = c("1.0.0", NA_character_),
  compare = c(">=", NA_character_)
)
#> Warning in info$cmp[has_version] <- compare: number of items to replace is not
#> a multiple of replacement length
#> [1] TRUE

# similar situation, but no warning
rlang::is_installed(pkg = "tidyr", version = NA_character_, compare = NA_character_)
#> [1] TRUE

# when version/compare fully specified, no warning
rlang::is_installed(
  pkg = c("dplyr", "tidyr"),
  version = c("1.0.0", "1.0.0"),
  compare = c(">=", ">=")
)
#> [1] TRUE

Created on 2024-03-03 with reprex v2.1.0

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

1 participant