[Bioc-devel] Defining functions inside main functions

Kern, Lori Lor|@Shepherd @end|ng |rom Ro@we||P@rk@org
Tue Jul 5 19:40:00 CEST 2022

If I understand correctly, then yes I would say this is the correct approach. Try and place the repeated code sections into the smaller functions and call when needed.  If they are only used internally, then do not export, and then they would not require documentation.
The smaller function approach is also recommended as it often allows easier testing and creation of tests (sometimes but not always the case)


Lori Shepherd - Kern

Bioconductor Core Team

Roswell Park Comprehensive Cancer Center

Department of Biostatistics & Bioinformatics

Elm & Carlton Streets

Buffalo, New York 14263

From: Bioc-devel <bioc-devel-bounces using r-project.org> on behalf of Arman Shahrisa <shahrisa.arman using hotmail.com>
Sent: Tuesday, July 5, 2022 1:09 PM
To: bioc-devel <bioc-devel using r-project.org>
Subject: [Bioc-devel] Defining functions inside main functions


I�m the maintainer of package �cbaf�.

I have a code section that needs to be repeated several times in a function
and another code section that is repeated in two other functions.

I was thinking about creating a small function inside each function and then,
calling small functions whenever needed.

Is this the best way to do it? Does it require documentation?

Best wishes,

        [[alternative HTML version deleted]]

This email message may contain legally privileged and/or confidential information.  If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited.  If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.
	[[alternative HTML version deleted]]

More information about the Bioc-devel mailing list