You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just submitted #101 and now I'm wondering: Are there any plans on factoring out the needs_packages() function into a separate package? Or maybe introduce something similar in pak?
This implementation of course is not very sophisticated and it could be improved (i.a. provide an auto-generated code snippet to install the missing packages in the error message).
But it still provides a frequently used check: Test if package xyz, which is only suggested but not imported, is installed and if not, throw an informative error. I would really like to have a "standardized" way to do this!
The text was updated successfully, but these errors were encountered:
It seems like you want to use this programmatically. I think introducing a new dependency for these 10 lines of mostly trivial code is probably not worth it, so I would say just copy this function into your package(s).
Sure, I didn't really mean to export it in the current form, sorry for being a bit unclear. I was rather asking if there are any plans on your side (the people around tidyverse, r-lib, r-hub, RStudio etc.) on introducing such a function in a new (or existing, e.g. pak) package in the near future. 🙂
After all, it's an action that's frequently used in a lot of packages and it would be cool to have a best practice implementation in one place (kinda like rlang::arg_match() for argument matching).
But I guess your answer means there are no such plans, right?
FWIW, there is also rlang::is_installed()
Thanks for the hint! I just created r-lib/rlang#991 to make it vectorized... I hope you're not about to rip it right out of the air. 😅
I just submitted #101 and now I'm wondering: Are there any plans on factoring out the
needs_packages()
function into a separate package? Or maybe introduce something similar in pak?Currently, the function looks like this:
pkgsearch/R/utils.R
Lines 100 to 127 in 9c0102e
This implementation of course is not very sophisticated and it could be improved (i.a. provide an auto-generated code snippet to install the missing packages in the error message).
But it still provides a frequently used check: Test if package xyz, which is only suggested but not imported, is installed and if not, throw an informative error. I would really like to have a "standardized" way to do this!
The text was updated successfully, but these errors were encountered: