r-lib / rlang

Low-level API for programming with R
https://rlang.r-lib.org
Other
498 stars 136 forks source link

Difference in documentation and implementation for `check_installed` #1628

Open bart1 opened 1 year ago

bart1 commented 1 year ago

Currently the function forces ... to be empty while the documentation says they are passed on to action:

rlang::check_installed("testpkg","testreason","testarg", action=install.packages)
#> Error in `rlang::check_installed()`:
#> ! `...` must be empty.
#> ✖ Problematic argument:
#> • ..1 = "testarg"
#> ℹ Did you forget to name an argument?
#> Backtrace:
#>     ▆
#>  1. └─rlang::check_installed("testpkg", "testreason", "testarg", action = install.packages)
#>  2.   └─rlang::check_dots_empty0(...)
#>  3.     └─rlang::check_dots_empty(call = call)
#>  4.       └─rlang:::action_dots(...)
#>  5.         ├─base (local) try_dots(...)
#>  6.         └─rlang (local) action(...)

Here is the documentation: https://github.com/r-lib/rlang/blob/b8cb26d89dcfbd8bdac1bbff3d6d31ccdc8ceee4/R/session.R#L190 I'm happy to create a pull request either way but I'm not sure what is the desirable behavior

lionel- commented 1 year ago

Hmm the doc could be clearer, what I meant is that the function that you pass as action must take pkg and ... arguments.