Open mark-andrews opened 3 years ago
To silence loading messages we can also do
suppressMessages(library(GGally))
but defining the name space is good too.
The Wickham, who can not be wrong about anything ever, says one must always use the namespaced functions in R code in R packages. So e.g. we would do
GGally::ggairs ...
on https://github.com/mark-andrews/psyntur/blob/10319a588cda8e7b56da5f31ba12b8d11c99cfd7/R/visualization-utils.R#L256
and so on elsewhere.
Actually, this makes tidyverse
and ggplot
code quite verbose, as you have to use the namespace for every function, but it is safer to use generally.
Is the reason to avoid masking issues? I can see how it is saver to use the name space.
Yes, it is too avoid masking. Here's a reading from the Book of Wickham: https://r-pkgs.org/namespace.html
This apparently is not easy to fix. Using the ::
approach does not solve it it seems. When GGally
code runs, it itself does a library
command that triggers it. See https://stackoverflow.com/questions/67356592/registered-s3-method-overwritten-by-ggally-method-from-gg-rstudio-loading
We also can't resort to suppressMessages
as the imports in psyntur
are not issued by library
commands but by the import
commands in NAMESPACE
, which are auto generated and can't be wrapped by suppressMessages
.
There is talk about solving this upstream, either in ggplot2
or GGally
, see https://github.com/ggobi/ggally/issues/292. I will leave it to them to solve it. In the meantime, we will leave this as is, which is annoying :(.
I am re-opening this issue because we need this problem to go away ultimately as it creates a spurious warning that will distract users.
Basically, every time we do library(psyntur)
, we get this warning/message and it seems impossible to suppress internally in the psyntur
package.
I still don't know fully who is responsible for this message, GGally
or ggplot2
, or if there is some fix to it, but it is a really annoying message. It is bad for my mental well-being, and bad for the mental well-being of all psyntur
users.
On load of package, we get this:
I presume we can avoid this if
GGally
is not loaded but used viaGGally::