Package Development: Multiple files or Single File
I've been poking through a bunch of different packages and I'm noticing that there really isn't a clear and concise method for function storage. Some package authors pack all of them in one file while other autho开发者_开发问答rs split them into individual files.
I've read a number of package creation guides but none of them provide specific guidelines or suggestions.
Would love to hear your thoughts on this.
The best reference I have found on the topic thus far is from Hadley Wickham's R book draft. Quoting from there:
It's up to you how you arrange your functions into files, but I suggest grouping related functions into a single file. My rule of thumb is that if I can't remember which file a function lives in, I probably need to split them up into more files - having one function per file is perfectly reasonable, particularly if the functions are large or have a lot of documentation.
I use one function per file. It helps me in the developing stage because I can source
individual file (CTRL+R+S in Eclipse) and have a changed function handy. I also prefer changing tabs than scrolling up and down a single file. But at the end of the day it probably depends on what you're used to and what tools you use for development.
精彩评论