[Bioc-devel] Is magrittr "%>%" acceptable in bioc packages?

Aaron Lun |n||n|te@monkey@@w|th@keybo@rd@ @end|ng |rom gm@||@com
Sat Aug 17 22:10:46 CEST 2019

Vince's answer gives the official position, to which I'll add my 
personal opinions for my little corner of the world.

Every previous release, I had routine rounds of "depiping" where I go 
through any package that I'm heavily involved in and strip out any %>% 
calls. I think I've gotten the last of them in this release, but one 
must never be too careful. The reasons for this behavior are 2-fold:

- Pipes encourage these long expressions where A %>% B %>% .... %>% Z. 
These are hard to debug. Sure, you could use debug_pipeline() or 
debug_pipe() but then you need to copy the whole chain and wrap it in a 
debug_pipeline() or stick a debug_pipe() in the middle... geez. I just 
want to step through a debug()'d function and look at each step.

And sometimes debug()ing isn't even possible (e.g., S4 method bodies, or 
complex scenarios involving repeated calls to a problematic function). 
In such cases, I spam print() statements on the intermediate objects for 
debugging. If I had pipes, this would require me to break up the chain 
to extract the intermediate construct for interrogation.

- They are hard to read. While technically you only have to think about 
each step of the chain as you go along, the way that it's presented 
means that, in practice, you're forced to reason about the whole chain 
at once. I'd also rather avoid having to even think about the many faces 
of "." when looking at code that I'm not familiar with.

The use of %>% chains is tolerable in some cases, e.g., interactive 
analysis code that you're writing from scratch where brevity of 
expression is important. But package code is "write once, read hundreds 
of times" where it helps to be more verbose.

So, to answer your question: not in my backyard.


On 8/17/19 1:52 AM, Vincent Carey wrote:
> On Sat, Aug 17, 2019 at 4:40 AM Venu Thatikonda <thatikonda92 using gmail.com>
> wrote:
>> Hi,
>> As the title says, is %>% acceptable in bioc packages? With BiocCheck, I
>> get a WARNING that is "Add non-empty \\value sections to the following man
>> pages: man/pipe.Rd".
> Yes magrittr is acceptable.  The warning says (I think) that you have a man
> page for
> a topic 'pipe' but did not put a \value section for the man page.  If using
> roxygen you
> would want to have a @return element in your documentation, to avoid this
> warning.
>> Is it okay even if this warning appears ? `R CMD check` didn't give
>> warnings about it.
> Try to avoid the warning.  If you have difficulty, report back.
>> Thank you.
>> --
>> Best regards
>> Venu Thatikonda
>> https://itsvenu.github.io/
>>          [[alternative HTML version deleted]]
>> _______________________________________________
>> Bioc-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/bioc-devel

More information about the Bioc-devel mailing list