Forcing package to attach without masking warning

125 views Asked by At

Is there a way to specify that a library should not throw warnings regarding name clashes and masked objects whenever it is attached? I imagine a solution would involve editing the description or one of the special functions such as .onAttach but I can't find anything solving this issue.

I ask becuase the warnings are unneeded. I have defined my own S3 class and the masked function is still called by the default method of the masking function:

median <- function(x, ...) UseMethod("median")

median.default <- stats::median.default

In the event that a user is using median on a typical R data structure such as a vector, the median method in my package will call the masked function automatically, so there is no real need for the user to be aware of the masking.

1

There are 1 answers

0
Grosvenor On

I'm not sure if your question is that you don't want the user to see the warnings, or that you don't want the warnings to occur.

If the former, you might be able to use shhh in the tfse library around your library call. Or, if it's just for yourself, you could set the warn.conflicts = FALSE argument when calling the library.

If the latter, it would be clearly more elegant to rewrite the offending method so it doesn't conflict in the namespace.