In previous versions of knitr, I was able to set the chunk option message = FALSE
and it would both have the documented feature of preventing messages from going to the text document (markdown in this case) and would also have the undocumented feature of disabling the interception of messages, allowing me to capture messages within the chunk to reformat and output to markdown as I wished. With the new version of knitr (1.43), this no longer seems to work and thus has broken a fair amount of my report generation code. Setting message = FALSE
now seems to result in messages being intercepted without allowing code within the chunk to capture them with functions like capture.output()
. My workaround has been to write functions in chunks that I can use to capture messages in inline R code, where any messages generated seem to be left alone by knitr. This makes for pretty sloppy code and is less than convenient, and it seems to me like knitr should retain a feature allowing me to tell a chunk to ignore message and error reporting and let me do with them as I please in terms of reformatting them and sending them to the text document. I am not sure this would be considered a bug, but it does seem like an undocumented feature change (or at least I cannot find the documentation of the desired behavior).
Anyone know of a more predictable and stable way to prevent knitr from interfering with custom message and error management within chunks? (I know that I can use inline code, but for reasons I don't want to detail here, I would rather use chunks.)
In old versions of knitr, setting the chunk option message = FALSE
used to allow me to capture messages within the chunk and format them for output myself. I was expecting this to continue to work with new versions of knitr.