Skip to content

Error: fn must be an R function with conflict_prefer #46

@DanChaltiel

Description

@DanChaltiel

I cannot use the conflict_prefer function at all, while it works perfectly on my collegue's computer. Here is my call of the first example in the help:

library(conflicted)
conflict_prefer("filter", "dplyr")

Tthis throws this error:

[conflicted] Removing existing preference
[conflicted] Will prefer stats::filter over any other package
Error: fn must be an R function, not a primitive function

Here is the error trace:

> rlang::last_error()
<error>
message: `fn` must be an R function, not a primitive function
class:   `rlang_error`
backtrace:
 1. conflicted::conflict_prefer("filter", "stats")
 2. conflicted:::conflicts_register()
 3. conflicted::conflict_scout(pkgs)
 4. conflicted:::map2(names(conflicts), conflicts, superset_principle)
 5. base::mapply(.f, .x, .y, MoreArgs = list(...), SIMPLIFY = FALSE)
 7. conflicted:::is_superset(fun, non_base, base = base)
 8. rlang::fn_fmls(base_obj)
 9. rlang:::check_closure(fn)
Call `rlang::last_trace()` to see the full backtrace

> rlang::last_trace()
    x
 1. \-conflicted::conflict_prefer("filter", "stats")
 2.   \-conflicted:::conflicts_register()
 3.     \-conflicted::conflict_scout(pkgs)
 4.       \-conflicted:::map2(names(conflicts), conflicts, superset_principle)
 5.         \-base::mapply(.f, .x, .y, MoreArgs = list(...), SIMPLIFY = FALSE)
 6.           \-(function (fun, pkgs) ...
 7.             \-conflicted:::is_superset(fun, non_base, base = base)
 8.               \-rlang::fn_fmls(base_obj)
 9.                 \-rlang:::check_closure(fn)

> packageVersion("conflicted")
[1] ‘1.0.4’

> session_info()
- Session info ------------------------------------------------------------
 setting  value                       
 version  R version 3.5.2 (2018-12-20)
 os       Windows >= 8 x64            
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  French_France.1252          
 ctype    French_France.1252          
 tz       Europe/Paris                
 date     2019-09-06                  

- Packages ----------------------------------------------------------------
#[... a lot of packages...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions