[Bioc-devel] best practice: verbose messages

Martin Morgan mtmorgan at fhcrc.org
Wed Jul 10 20:14:20 CEST 2013


----- Kasper Daniel Hansen <kasperdanielhansen at gmail.com> 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.

Michael's point is reflected in the fact that by default message() goes to stderr while cat() goes to stdout. And Dan's observation about suppressMessages() is that messages are actually conditions that can be constructed and managed e.g., by tryCatch(). 

For the output implied by a verbose option, I'd go with message().

Martin

> 
> 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



More information about the Bioc-devel mailing list