-
Notifications
You must be signed in to change notification settings - Fork 129
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
After expose_imports(myPackage), the package functions cannot find @importFrom objects #1286
Comments
An "import" in |
Thanks for the prompt reply. Still, I'm wondering why This works:
This doesn't work:
Which approach would you suggest if I want keep track of the functions in |
It looks like when you use |
Thanks for the feedback! I can confirm this approach works: Explicitly state the package for functions from
Then, after
|
Thanks for confirming. I just added a note in the help file of |
You know what? Instead of Also cc @tiernanmartin. Below, the library(drake)
plan <- drake_plan(x = myPlot(plotData = cars, x = "speed", y = "dist"))
vis_drake_graph(plan, envir = getNamespace("myPackage")) And the package code can still find make(plan, envir = getNamespace("myPackage"))
#> ▶ target x
readd(x) |
Also cc @richardbayes |
Just deprecated expose_imports() for this reason. |
Thanks. If you have multiple analysis packages to track, however, I don't see how to implement it with the |
True, but I do not see this as very common. A single research project will typically have a single research compendium, and other packages should usually be locked down with |
This will work for my use case 👍 Thanks, Will! |
This is great a great solution, @wlandau! I had problems with invalidating targets when executing my packaged |
The limitation I see with ls()
#> character(0)
import::from(dplyr, mutate, .into = "")
ls()
#> [1] "mutate"
library(drake)
plan <- drake_plan(x = mutate(mtcars, x = 1))
vis_drake_graph(plan) Created on 2020-09-05 by the reprex package (v0.3.0) |
@wlandau thanks for your answer, I provided another example which deals with self defined functions in the comment. As an alternative to From the docs: |
Just added new package-tracking functionality in |
Prework
drake
's code of conduct.drake
and most likely not a user error. (If you run into an error and do not know the cause, please submit a "Trouble" issue instead.)Description
After running
drake::expose_imports(testDrake)
, functions imported bytestDrake
from other packages seem to be lost.Reproducible example
Say, I wrote a package with a custom plot function, which imports some functions from a CRAN R package, e.g. ggplot2.
Now, this custom plot function runs perfectly.
Next, I want to keep track of changes within the custom plot function which is under development. I do so via the
drake::expose_imports()
. However, after running this command, I get an error message that the ggplot functions could not be found anymore:I also tried loading
testDrake
again, which results in the same errorOf course, I can fix by loading
ggplot2
, but in practice, the packagetestDrake
imports from more than 1 package and the number of imported packages can also change during development. So I was hoping for a neater solution.Expected result
I would expect the imported ggplot functions would not be lost.
Session info
The text was updated successfully, but these errors were encountered: