Comments (16)
This happens also with h2o
R Library :(
from conflicted.
from conflicted.
If you put the first call below in your RProfile it seems to work ok :
setHook(
packageEvent("conflicted", "attach"),
function(...) {
invisible(suppressMessages(trace(conflicted:::is_superset, quote(
if(is.primitive(get(fun))) {
# hacking the existing exception for "lag"
pkg <- "dplyr"
fun <- "lag"
}
), print = FALSE)))
}
)
library(conflicted)
#> Warning: package 'conflicted' was built under R version 4.0.5
library(inops)
x <- 1:5
x < 3 <- 0
#> Error: [conflicted] `<<-` found in 2 packages.
#> Declare a preference with `conflict_prefer()`:
#> * conflict_prefer("<<-", "inops")
#> * conflict_prefer("<<-", "base")
conflict_prefer("<<-", "base")
#> [conflicted] Will prefer base::`<<-` over any other package
x < 3 <- 0
#> Error in x < 3 <- 0: incorrect number of arguments to "<<-"
conflict_prefer("<<-", "inops")
#> [conflicted] Removing existing preference
#> [conflicted] Will prefer inops::`<<-` over any other package
x < 3 <- 0
x
#> [1] 0 0 3 4 5
# works with other packages mentionned in thread
suppressPackageStartupMessages({
library(h2o)
library(bit64)
})
#> Warning: package 'h2o' was built under R version 4.0.5
#> Warning: package 'bit64' was built under R version 4.0.3
#> Warning: package 'bit' was built under R version 4.0.3
`%*%`
#> Error: [conflicted] `%*%` found in 2 packages.
#> Declare a preference with `conflict_prefer()`:
#> * conflict_prefer("%*%", "h2o")
#> * conflict_prefer("%*%", "base")
`:`
#> Error: [conflicted] `:` found in 2 packages.
#> Declare a preference with `conflict_prefer()`:
#> * conflict_prefer(":", "bit64")
#> * conflict_prefer(":", "base")
Created on 2021-08-13 by the reprex package (v0.3.0)
from conflicted.
Just install #59 as a work around?
from conflicted.
This also happens with the bit64
library...
from conflicted.
when bit64:::
is in conflict with base:::
, fn_fmls fails
There's a reliance on fn_fmls()
which requires a function (and doesn't like 'primitive functions')
Also just a minor edit to say that this seems intended by rlang development:
r-lib/rlang#809 (comment)
library(bit64)
debug(conflicted:::is_superset)
library(conflicted)
#when bit64::`:` is in conflict with base::`:` , fn_fmls fails
#
# debug: args_base <- names(fn_fmls(base_obj))
# Browse[2]> n
# Error: package or namespace load failed for ‘conflicted’:
# .onAttach failed in attachNamespace() for 'conflicted', details:
# call: NULL
# error: `fn` must be an R function, not a primitive function
# In addition: Warning message:
# package ‘conflicted’ was built under R version 3.6.3
from conflicted.
I also experience this issue with the bit64 package. How do you fix it?
from conflicted.
This error makes the package unusable for me almost at the start.
from conflicted.
I've also experienced this - does anyone have a workaround?
from conflicted.
Thanks, @moodymudskipper - I'll give that a go!
from conflicted.
For reference, this happens in this situation:
author: njtierney
date: 2021-08-18
output:
reprex::reprex_document:
session_info: true
title: dopey-nyala_reprex.R
library(greta)
#>
#> Attaching package: 'greta'
#> The following objects are masked from 'package:stats':
#>
#> binomial, cov2cor, poisson
#> The following objects are masked from 'package:base':
#>
#> %*%, apply, backsolve, beta, chol2inv, colMeans, colSums, diag,
#> eigen, forwardsolve, gamma, identity, rowMeans, rowSums, sweep,
#> tapply
library(conflicted)
#> Error: package or namespace load failed for 'conflicted':
#> .onAttach failed in attachNamespace() for 'conflicted', details:
#> call: NULL
#> error: `fn` must be an R function, not a primitive function
Created on 2021-08-18 by the reprex package (v2.0.0.9000)
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.1.0 (2021-05-18)
#> os macOS Big Sur 10.16
#> system x86_64, darwin17.0
#> ui X11
#> language (EN)
#> collate en_AU.UTF-8
#> ctype en_AU.UTF-8
#> tz Australia/Perth
#> date 2021-08-18
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> backports 1.2.1 2020-12-09 [1] CRAN (R 4.1.0)
#> base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.1.0)
#> callr 3.7.0 2021-04-20 [1] CRAN (R 4.1.0)
#> cli 3.0.0.9000 2021-07-05 [1] Github (r-lib/cli@82178a4)
#> coda 0.19-4 2020-09-30 [1] CRAN (R 4.1.0)
#> codetools 0.2-18 2020-11-04 [1] CRAN (R 4.1.0)
#> conflicted 1.0.4 2019-06-21 [1] CRAN (R 4.1.0)
#> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.1.0)
#> digest 0.6.27 2020-10-24 [1] CRAN (R 4.1.0)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.0)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.1.0)
#> fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.0)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.0)
#> future 1.21.0 2020-12-10 [1] CRAN (R 4.1.0)
#> globals 0.14.0 2020-11-22 [1] CRAN (R 4.1.0)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.1.0)
#> greta * 0.3.1.9012 2021-08-06 [1] local
#> highr 0.9 2021-04-16 [1] CRAN (R 4.1.0)
#> hms 1.1.0 2021-05-17 [1] CRAN (R 4.1.0)
#> htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.1.0)
#> jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.1.0)
#> knitr 1.33 2021-04-24 [1] CRAN (R 4.1.0)
#> lattice 0.20-44 2021-05-02 [1] CRAN (R 4.1.0)
#> lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.1.0)
#> listenv 0.8.0 2019-12-05 [1] CRAN (R 4.1.0)
#> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.1.0)
#> Matrix 1.3-4 2021-06-01 [1] CRAN (R 4.1.0)
#> parallelly 1.26.1 2021-06-30 [1] CRAN (R 4.1.0)
#> pillar 1.6.2 2021-07-29 [1] CRAN (R 4.1.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.0)
#> png 0.1-7 2013-12-03 [1] CRAN (R 4.1.0)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.0)
#> processx 3.5.2 2021-04-30 [1] CRAN (R 4.1.0)
#> progress 1.2.2 2019-05-16 [1] CRAN (R 4.1.0)
#> ps 1.6.0 2021-02-28 [1] CRAN (R 4.1.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.0)
#> R6 2.5.0 2020-10-28 [1] CRAN (R 4.1.0)
#> Rcpp 1.0.7 2021-07-07 [1] CRAN (R 4.1.0)
#> reprex 2.0.0.9000 2021-07-02 [1] Github (tidyverse/reprex@5cf02b4)
#> reticulate 1.20 2021-05-03 [1] CRAN (R 4.1.0)
#> rlang 0.4.11 2021-04-30 [1] CRAN (R 4.1.0)
#> rmarkdown 2.9 2021-06-15 [1] CRAN (R 4.1.0)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.0)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.0)
#> stringi 1.7.3 2021-07-16 [1] CRAN (R 4.1.0)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.0)
#> styler 1.4.1 2021-03-30 [1] CRAN (R 4.1.0)
#> tensorflow 2.5.0 2021-06-10 [1] CRAN (R 4.1.0)
#> tfruns 1.5.0 2021-02-26 [1] CRAN (R 4.1.0)
#> tibble 3.1.3 2021-07-23 [1] CRAN (R 4.1.0)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.0)
#> vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.1.0)
#> whisker 0.4 2019-08-28 [1] CRAN (R 4.1.0)
#> withr 2.4.2 2021-04-18 [1] CRAN (R 4.1.0)
#> xfun 0.24 2021-06-15 [1] CRAN (R 4.1.0)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.1/Resources/library
vs the opposite order
author: njtierney
date: 2021-08-18
output:
reprex::reprex_document:
session_info: true
title: next-esok_reprex.R
library(conflicted)
library(greta)
#> Error: `fn` must be an R function, not a primitive function
Created on 2021-08-18 by the reprex package (v2.0.0.9000)
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.1.0 (2021-05-18)
#> os macOS Big Sur 10.16
#> system x86_64, darwin17.0
#> ui X11
#> language (EN)
#> collate en_AU.UTF-8
#> ctype en_AU.UTF-8
#> tz Australia/Perth
#> date 2021-08-18
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> backports 1.2.1 2020-12-09 [1] CRAN (R 4.1.0)
#> base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.1.0)
#> cachem 1.0.5 2021-05-15 [1] CRAN (R 4.1.0)
#> callr 3.7.0 2021-04-20 [1] CRAN (R 4.1.0)
#> cli 3.0.0.9000 2021-07-05 [1] Github (r-lib/cli@82178a4)
#> coda 0.19-4 2020-09-30 [1] CRAN (R 4.1.0)
#> codetools 0.2-18 2020-11-04 [1] CRAN (R 4.1.0)
#> conflicted * 1.0.4 2019-06-21 [1] CRAN (R 4.1.0)
#> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.1.0)
#> digest 0.6.27 2020-10-24 [1] CRAN (R 4.1.0)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.0)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.1.0)
#> fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.0)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.0)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.0)
#> future 1.21.0 2020-12-10 [1] CRAN (R 4.1.0)
#> globals 0.14.0 2020-11-22 [1] CRAN (R 4.1.0)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.1.0)
#> greta * 0.3.1.9012 2021-08-06 [1] local
#> highr 0.9 2021-04-16 [1] CRAN (R 4.1.0)
#> hms 1.1.0 2021-05-17 [1] CRAN (R 4.1.0)
#> htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.1.0)
#> jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.1.0)
#> knitr 1.33 2021-04-24 [1] CRAN (R 4.1.0)
#> lattice 0.20-44 2021-05-02 [1] CRAN (R 4.1.0)
#> lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.1.0)
#> listenv 0.8.0 2019-12-05 [1] CRAN (R 4.1.0)
#> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.1.0)
#> Matrix 1.3-4 2021-06-01 [1] CRAN (R 4.1.0)
#> parallelly 1.26.1 2021-06-30 [1] CRAN (R 4.1.0)
#> pillar 1.6.2 2021-07-29 [1] CRAN (R 4.1.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.0)
#> png 0.1-7 2013-12-03 [1] CRAN (R 4.1.0)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.0)
#> processx 3.5.2 2021-04-30 [1] CRAN (R 4.1.0)
#> progress 1.2.2 2019-05-16 [1] CRAN (R 4.1.0)
#> ps 1.6.0 2021-02-28 [1] CRAN (R 4.1.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.0)
#> R6 2.5.0 2020-10-28 [1] CRAN (R 4.1.0)
#> Rcpp 1.0.7 2021-07-07 [1] CRAN (R 4.1.0)
#> reprex 2.0.0.9000 2021-07-02 [1] Github (tidyverse/reprex@5cf02b4)
#> reticulate 1.20 2021-05-03 [1] CRAN (R 4.1.0)
#> rlang 0.4.11 2021-04-30 [1] CRAN (R 4.1.0)
#> rmarkdown 2.9 2021-06-15 [1] CRAN (R 4.1.0)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.0)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.0)
#> stringi 1.7.3 2021-07-16 [1] CRAN (R 4.1.0)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.0)
#> styler 1.4.1 2021-03-30 [1] CRAN (R 4.1.0)
#> tensorflow 2.5.0 2021-06-10 [1] CRAN (R 4.1.0)
#> tfruns 1.5.0 2021-02-26 [1] CRAN (R 4.1.0)
#> tibble 3.1.3 2021-07-23 [1] CRAN (R 4.1.0)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.0)
#> vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.1.0)
#> whisker 0.4 2019-08-28 [1] CRAN (R 4.1.0)
#> withr 2.4.2 2021-04-18 [1] CRAN (R 4.1.0)
#> xfun 0.24 2021-06-15 [1] CRAN (R 4.1.0)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.1/Resources/library
from conflicted.
Unfortunately this doesn't prevent my error :( - I tried having a local .Rprofile
for my project with the code:
This is really unfortunate, as I need to use greta
in my work - and the conflicted
package is now a key part of my workflow, and I now need to remove conflicted from my work, which means developing a workaround - which is unfortunately not trivial.
from conflicted.
I got this to work by adding warn.conflicts = FALSE
like so:
library(conflicted)
library(greta, warn.conflicts = FALSE)
from conflicted.
Ah, for this to work, I needed the following in my local Rprofile:
setHook(
packageEvent("conflicted", "attach"),
function(...) {
invisible(suppressMessages(trace(conflicted:::is_superset, quote(
if(is.primitive(get(fun))) {
# hacking the existing exception for "lag"
pkg <- "dplyr"
fun <- "lag"
}
), print = FALSE)))
}
)
library(conflicted)
from conflicted.
Hi there @hadley / @batpigandme
Sorry to bother you here, but I was just wondering if you have a recommended workaround for this or plans to fix?
It currently means we can't really use conflicted
with some projects if we use certain packages.
This introduces a pretty huge amount of friction, as we came to really depend on conflicted
, and to switch back to life pre-conflicted
is very challenging.
from conflicted.
Thanks, Hadley! :)
from conflicted.
Related Issues (20)
- Update README with box package
- Upkeep for conflicted (2022)
- Use standard argument checkers
- 'verbose' is not an exported object from 'namespace:R.utils' HOT 1
- FR: Rank of preferred conflicted packages
- Scan for conflicts in internal functions? HOT 4
- "summarize()" isn't considered to be in dplyr, even though it's a synonym for "summarise()" HOT 2
- Over Conflicted? HOT 5
- sticky conflicted package : remains in the namespace even after restarting R HOT 1
- consider accepting input like `"dplyr::filter"`? HOT 4
- conflicted_prefer seems to have trouble with package names with . in them as in "data.table" HOT 1
- FR: Prefer an entire package in one call HOT 2
- Respecting `exclude` and `include.only` HOT 1
- Release conflicted 1.2.0
- Weird interaction with targets package HOT 2
- later one automatically takes precendence when accidentally using multiple conflicts_prefer with same object name HOT 1
- Using `conflicts_prefer()` et al. in `.Rprofile` no longer works HOT 5
- warning when preferred package is not loaded
- Resolution of conflicts between a function and a method that's being reexported
- Improve `conflict_scout()` behavior after resolving conflicts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conflicted.