[Bioc-devel] best practice: verbose messages

Hervé Pagès hpages at fhcrc.org
Wed Jul 10 21:10:26 CEST 2013


Hi Kasper,

On 07/10/2013 10:50 AM, Kasper Daniel Hansen wrote:
> On Wed, Jul 10, 2013 at 12:38 PM, Dan Tenenbaum <dtenenba at fhcrc.org> wrote:
>
>> On Wed, Jul 10, 2013 at 9:17 AM, Michael Lawrence
>> <lawrence.michael at gene.com> wrote:
>>> If it's an informational message, like one you might log, use message().
>> If
>>> you're rendering an object as text, like in a show method, use cat().
>>>
>>
>> Another thing to consider is that messages can be suppressed with
>> suppressMessages() but cat() output cannot.
>
>
> Sure.  What I cannot decide is whether that is good or bad.

If you use message(), then you don't need to have a 'verbose' arg since
the messages can be suppressed with suppressMessages(). That makes
your code simpler/cleaner. However this approach is only appropriate if
you want your function to be verbose by default. If you want it to be
quiet by default then I don't know what's best. 'verbose' arg + cat() or
'verbose' arg + message() ? That's the question...

H.

>
> Kasper
>
>
>
>
>>
>> Dan
>>
>>
>>> Just my opinion,
>>> Michael
>>>
>>>
>>> On Wed, Jul 10, 2013 at 8:24 AM, Kasper Daniel Hansen <
>>> kasperdanielhansen at gmail.com> wrote:
>>>
>>>> Should I use cat() or message() (or something else) for
>>>>    if(verbose) cat("my message\n")
>>>>
>>>> Best,
>>>> Kasper
>>>>
>>>>          [[alternative HTML version deleted]]
>>>>
>>>> _______________________________________________
>>>> Bioc-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>>>
>>>
>>>          [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> Bioc-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioc-devel mailing list