Skip to content
Prev 337966 / 398500 Next

LOOKING FOR CODE REPOSITORY

Although there is a great deal of value to be gained by understanding how "package" code is written, most of my R "projects" consist of a file with 10-100 lines of code working with data in the global environment that call on packages. Such code is not typically posted online.

I do find it convenient to split my one file into three: an "output" file that starts off by using the source function to execute the main "work" file. If I write any non trivial functions, I put them in a third file and source that at the beginning of the "work" file. The output file has all my print, summary, and plot-type statements. I can re-compute all my work at any time by just executing the source statement in my output file. Having my project-specific functions in their own file makes it easier to reload them all when I edit several of them. It also makes debugging in RStudio easier because it links function code to line numbers. I also write roxygen-style comments for my functions to ease putting them into packages later should they prove to be generally applicable, and refer to those comments if I forget what the arguments are for.

HTH
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
On March 20, 2014 10:49:33 AM PDT, Greg Snow <538280 at gmail.com> wrote: