-
Notifications
You must be signed in to change notification settings - Fork 231
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
feature request: Support for conditional @importFrom #378
Comments
I'd like to +1 this. A good example is trying to: |
I think it's better to just do foo::bar and avoid the conditional include. But roxygen does need a way to include literal text in the namespace. |
Is this allowed in CRAN submissions? |
Yes |
related to #371 |
Some base-R functions are not available under all OSes. If you want to use these functions in a cross-platform way, then you need to conditionally import the function.
Full discussion on r-package-devel.
For example,
utils::win.version
is only available under Windows. If your package includes a function that calls this, the NAMESPACE file should contain a conditional importFrom:The way I'd typically write such a function would be this:
AFAIK, there currently isn't a way to specify the
@importFrom
line to make it conditional. This would be a nice feature.Possible syntax would be
#' @importFrom utils win.version .Platform$OS.type == "windows"
. That is, anything after the function name up to a newline would be considered as a condition to go in an if block.The text was updated successfully, but these errors were encountered: