Hi,
I have such a question as how to check in R, which packages in my current R session that are listed in
sessionInfo() contain functions with exactly the same names, e.g:
flextable::border() and ggpubr::border()
dplyr::intersect() and base::intersect()
Hmisc::is.discrete() and plyr::is.discrete()
How to check it out in order to know in advance, that RStudio at startup loaded packages with the same functions' names and it could cause conflicts/errors?
So eg. I want to use a function count() and in what currently loaded package is it in ?
When you load packages with conflicting names, you are getting the version of last loaded package. To avoid confusion, I would suggest to always use qualified imports, e.g., dplyr::select. This way you don't need to care/remember which package is loaded when.
Another way is to use conflicted package (https://github.com/r-lib/conflicted#conflicted). There, you either explicitly say which functions should be used when or you get an error when you encounter an ambiguous function.
The base function conflicts() will list duplicates in the search path. Combine that result with find() (documented in utils::apropos) and I think it answers your question.
Grosscol's solution - I wish it worked in a simpler way but it gives a little bit vague output:
List of 2 axis.line : list()
..- attr(*, "class")= chr [1:2] "element_blank" "element"
panel.background:List of 5
.. fill : NULL
.. colour : chr [1:356]
..$ size :function (what, mode = "any", numeric = FALSE, simple.words = TRUE)
That's odd that our results are so different. I don't know what is going on in the environment. You might try clearing your environment, only loading a couple of packages like dplyr and tidyr, then re-running the conflict listing code. See if that gets your results closer to what I'm seeing.
To get a matrix output, you might try running the sapply approach and namespace the references to the functions base::conflicts() and utils::find.
Also, please copy and paste your output using this forum's formatting blocks. Posting images of text is difficult for me to read.