-
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
Object not found when function inspects call with a named object made by drake #590
Comments
This is an interesting edge case. Apparently, we need library(drake)
library(ade4)
data(doubs)
dudi1 <- dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$fish, scann = FALSE)
omi <- niche.param(nic1)
rm(dudi1)
omi <- niche.param(nic1)
#> Error in eval(expr, p): object 'dudi1' not found Created on 2018-11-30 by the reprex package (v0.2.1) This is because niche.param
#> function (x)
#> {
#> if (!inherits(x, "niche"))
#> stop("Object of class 'niche' expected")
#> appel <- as.list(x$call)
#> X <- eval.parent(appel[[2]])$tab
#> Y <- eval.parent(appel[[3]])
#> ... And in our case, library(drake)
library(ade4)
data(doubs)
my_plan = drake_plan(
dudi1 = dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3),
nic1 = niche(dudi1, doubs$fish, scann = FALSE),
omi = niche.param(nic1)
)
config <- drake_config(my_plan)
vis_drake_graph(config) Created on 2018-11-30 by the reprex package (v0.2.1) Why do we fail to notice A workaround is to explicitly mention dudi1 in the command for library(drake)
library(ade4)
data(doubs)
my_plan = drake_plan(
dudi1 = dudi.pca(doubs$env, scale = TRUE, scan = FALSE, nf = 3),
nic1 = niche(dudi1, doubs$fish, scann = FALSE)
)
make(my_plan)
#> target dudi1
#> target nic1
other_plan = drake_plan(
omi = {
dudi1
niche.param(nic1)
}
)
plan <- rbind(my_plan, other_plan)
make(plan)
#> target omi
config <- drake_config(plan)
vis_drake_graph(config) Created on 2018-11-30 by the reprex package (v0.2.1) In one sense, the bigger problem is actually the |
Woah! Thank you so much @wlandau for the explanation. I don't think either it would be a good idea for Thanks for the solution! |
Hey,
Thanks again @wlandau for building
drake
it is an amazing tool ;)I'm experiencing a problem with the
ade4
package that is due to the way the functionniche.param()
works (see the reprex).Basically the function inspects the object call when it was created (call when building
nic1
), and it fails because it can't find the original object (in my case thedudi1
object). Even though it is perfectly available through drake.Created on 2018-11-30 by the reprex package (v0.2.1)
Session info
The text was updated successfully, but these errors were encountered: