Re: [R] R modules
On 1/2/2007 12:46 PM, Geoffrey Zhu wrote: > Hi All, > > I'd like to know what is the best way to organize R code in multiple modules= > and files. The R code we are writing is too much for a single file. Besides= > , there are a lot of reusable functions we'd like to factor out. But writing= > a package for that is quite an over-kill and might be too inflexible. > > So what is the best way to organize R code into multiple files and reusable= > modules? Write a package for it. It's not overkill, it's using the tools the way they were designed to be used. Not all packages need to be submitted to CRAN, you can have a package for your own use. It gives you a way to organize your code and documentation, numerous code checking tools, namespaces, all sorts of good stuff. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R modules
You could have a master file that sources the rest: source("A.R") source("B.R") or you could save the function in a workspace and just load it back in; however, at some point I would move that all to a package. I typically will create a package for myself even if I have no intention of distributing it since it nicely puts together all the source and documentation and the checking tools are helpful to improve the QA. Its a bit of work to figure it all out the first time but once you are over that hump its worth it. On 1/2/07, Geoffrey Zhu <[EMAIL PROTECTED]> wrote: > Hi All, > > I'd like to know what is the best way to organize R code in multiple modules= > and files. The R code we are writing is too much for a single file. Besides= > , there are a lot of reusable functions we'd like to factor out. But writing= > a package for that is quite an over-kill and might be too inflexible. > > So what is the best way to organize R code into multiple files and reusable= > modules? > > Thanks, > Geoffrey > > > > ___=0A= > =0A= > =0A= > The information in this email or in any file attached hereto is=0A= > intended only for the personal and confidential use of the individual=0A= > or entity to which it is addressed and may contain information that is=0A= > proprietary and confidential. If you are not the intended recipient of=0A= > this message you are hereby notified that any review, dissemination,=0A= > distribution or copying of this message is strictly prohibited. This communi= > cation is for information purposes only and should not be regarded as an off= > er to sell or as a solicitation of an offer to buy any financial product. Em= > ail transmission cannot be guaranteed to be secure or error-free. > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R modules
Hi All, I'd like to know what is the best way to organize R code in multiple modules= and files. The R code we are writing is too much for a single file. Besides= , there are a lot of reusable functions we'd like to factor out. But writing= a package for that is quite an over-kill and might be too inflexible. So what is the best way to organize R code into multiple files and reusable= modules? Thanks, Geoffrey ___=0A= =0A= =0A= The information in this email or in any file attached hereto is=0A= intended only for the personal and confidential use of the individual=0A= or entity to which it is addressed and may contain information that is=0A= proprietary and confidential. If you are not the intended recipient of=0A= this message you are hereby notified that any review, dissemination,=0A= distribution or copying of this message is strictly prohibited. This communi= cation is for information purposes only and should not be regarded as an off= er to sell or as a solicitation of an offer to buy any financial product. Em= ail transmission cannot be guaranteed to be secure or error-free. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.