

Let’s open the DESCRIPTION file, created by the create() function. 4.2 GitHub for sharing package with othersĢ.4 DESCRIPTION file: R package information.



You should view a module as a stand alone and self-contained unit. Modules in files should not load other modules in other files.Modules make it easy to spread your code base across files and reuse them when needed.(Exports) variable assignment are local to a module and (a) do not pollute the global environment and (b) hide details of a module.(Imports) loading a package is local to a module and avoids name clashes in the global environment.Modules, in this context, present a more sophisticated way to source files by providing three important features: In those cases we often rely on splitting up the code base into files and source them into our R session (referring to the function source). However packages do present a hurdle for a lot of users with little programming background. R has two important building blocks to organize projects: functions and packages. Even relatively simple data analysis projects can span a thousand lines easily. Using modules we may gain some of the features we also expect from packages but with less overhead.Ī lot of R projects run into problems when they grow. This vignette explains how to use modules outside of R packages as a means to organize a project or data analysis.
