[Bioc-devel] message() and Sweave

Martin Morgan mtmorgan at fhcrc.org
Sat Nov 24 07:48:20 CET 2012


On 11/23/2012 08:19 PM, Laurent Gautier wrote:
> Try calling the function sink() in the beginning of your document.
>
> Best,
>
> Laurent
>
>
> On 2012-11-24 04:38, Kasper Daniel Hansen wrote:
>> It is recommended that things such as progress messages are
>> implemented using message() instead of cat().  However, message()
>> prints to stderr which results in the messages not being printed in a
>> Sweave document.
>>
>> How do I include the output of message() in a Sweave document?

?message talks about conditions and restarts, which leads to

   withCallingHandlers({
       x <- 1 + 2
       message("working...")
       x
   }, message = function(m) {
        cat("got message:", conditionMessage(m), "\n")
        invokeRestart("muffleMessage")
   })

which prints

got message: working...

[1] 3
 >

modelled after suppressMessages

Martin

>>
>> Kasper
>>
>> _______________________________________________
>> Bioc-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioc-devel mailing list