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
Dear package developers, a few minutes ago I was running some code in a (private) project that uses the packages conflicted and targets (and several more packages) and I noticed a weird interaction between the two of them. The following (quite long, sorry...) code exhibits the problem.
If I run the problematic code without targets, I get an expected error which raised by conflicted:
library(conflicted)
library(spatstat)
#> Loading required package: spatstat.data#> Loading required package: spatstat.geom#> spatstat.geom 3.0-6#> Loading required package: spatstat.random#> spatstat.random 3.1-3#> Loading required package: spatstat.explore#> Loading required package: nlme#> spatstat.explore 3.0-6#> Loading required package: spatstat.model#> Loading required package: rpart#> spatstat.model 3.2-1#> Loading required package: spatstat.linnet#> spatstat.linnet 3.0-6#> #> spatstat 3.0-3 #> For an introduction to spatstat, type 'beginner'
library(scales)
rescale(simplenet)
#> Error:#> ! [conflicted] rescale found in 2 packages.#> Either pick the one you want with `::`:#> * scales::rescale#> * spatstat.geom::rescale#> Or declare a preference with `conflicts_prefer()`:#> * `conflicts_prefer(scales::rescale)`#> * `conflicts_prefer(spatstat.geom::rescale)`#> Backtrace:#> x#> 1. \-conflicted (local) `<fn>`()#> 2. \-cli::cli_abort(...)#> 3. \-rlang::abort(...)
The same error occurs when conflicted is the last package I load. On other hand, when I run the previous code in a targets workflow, it looks like the conflicted package is ignored and I get another type of error (due to the fact that R runs scales::rescale instead of spatstat.geom::rescale):
library(targets)
tar_dir({
tar_script(
code= {
tar_option_set(packages= c("conflicted", "spatstat", "scales"))
list(
tar_target(
name="ABC",
command= rescale(simplenet)
)
)
}
)
tar_make()
})
#> * start target ABC#> x error target ABC#> * end pipeline [1.63 seconds]#> Error:#> ! Error running targets::tar_make()#> Error messages: targets::tar_meta(fields = error, complete_only = TRUE)#> Debugging guide: https://books.ropensci.org/targets/debugging.html#> How to ask for help: https://books.ropensci.org/targets/help.html#> Last error: no applicable method for 'rescale' applied to an object of class "c('linnet', 'list')"#> Backtrace:#> x#> 1. \-targets::tar_make()#> 2. \-targets:::callr_outer(...)#> 3. +-targets:::if_any(...)#> 4. \-targets:::callr_error(condition = out, fun = fun)#> 5. \-targets::tar_throw_run(message, class = class(condition))#> 6. \-targets::tar_error(...)#> 7. \-rlang::abort(message = message, class = class, call = tar_empty_envir)
I'm not sure if this is expected behaviour but I would say that, at least for me, this is quite surprising.
EDIT: The same error persists with the github version of the two packages. EDIT2: I also opened a discussion in the targets repo: ropensci/targets#1026
The text was updated successfully, but these errors were encountered:
The maintainer of the targets package added more details and a solution on the discussion page. If you think that nothing should be changed here, feel free to close!
Dear package developers, a few minutes ago I was running some code in a (private) project that uses the packages
conflicted
andtargets
(and several more packages) and I noticed a weird interaction between the two of them. The following (quite long, sorry...) code exhibits the problem.If I run the problematic code without
targets
, I get an expected error which raised byconflicted
:Created on 2023-02-24 with reprex v2.0.2
The same error occurs when
conflicted
is the last package I load. On other hand, when I run the previous code in atargets
workflow, it looks like theconflicted
package is ignored and I get another type of error (due to the fact that R runsscales::rescale
instead ofspatstat.geom::rescale
):Created on 2023-02-24 with reprex v2.0.2
The same does not occur when
conflicted
is the last loaded package:Created on 2023-02-24 with reprex v2.0.2
Session info
I'm not sure if this is expected behaviour but I would say that, at least for me, this is quite surprising.
EDIT: The same error persists with the github version of the two packages.
EDIT2: I also opened a discussion in the targets repo: ropensci/targets#1026
The text was updated successfully, but these errors were encountered: