[R] R modules

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jan 2 18:57:05 CET 2007


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 <gzhu at peak6.com> 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 at 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.
>



More information about the R-help mailing list