Skip to content
Prev 3487 / 12125 Next

[R-pkg-devel] Use of assignInNamespace in package

This in not well thought through, but what about using `sink` to capture 
any messages from the call? Then you might be able to remove the 
expected warning and output any remaining warnings if they are there...

However, note this part of `help(sink)`:

Sink-ing the messages stream should be done only with great care. For 
that stream file must be an already open connection, and there is no 
stack of connections.

Probably some of the real experts on the list can give you better advice :-)

f <- tempfile(fileext = ".Rout")
zz <- file(f, open = "wt")
sink(zz, type = "message")
warning("Expeced warning.")
warning("Another warning.")
sink(type = "message")
mesg <- readLines(f)
mesg

/Ege
On 07/02/2019 10.58, Hugh Parsonage wrote: