Dear R-people, I want to use an idea from LaTeX in the work flow with R. It is possible in LaTeX to have a main file from which other files are called (ie included). So for example if you have book, the main index file would call each chapter separately. Is there something comparable in R that follows the above 'include' idea from LaTeX? A main file that calls parts of an analysis or data preparation separately. Thanks! Michael
Perhaps ?source. Gabor On Fri, Sep 26, 2008 at 2:49 PM, Michael Schulte <michael.schulte at uib.no> wrote:> Dear R-people, > > I want to use an idea from LaTeX in the work flow with R. > It is possible in LaTeX to have a main file from which other files are > called (ie included). > So for example if you have book, the main index file would call each chapter > separately. > > Is there something comparable in R that follows the above 'include' idea > from LaTeX? > A main file that calls parts of an analysis or data preparation separately. > > Thanks! > Michael > > ______________________________________________ > R-help at r-project.org 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. >
Marianne Promberger
2008-Sep-26 13:05 UTC
[R] include scripts into main file (the LaTeX way)
Hi, On Friday, 26 September 2008, 14:49 (UTC+0200), Michael Schulte wrote: [...]> So for example if you have book, the main index file would call each > chapter separately. > > Is there something comparable in R that follows the above 'include' idea > from LaTeX?I've used source() for that. m. -- Marianne Promberger Graduate student in Psychology http://www.psych.upenn.edu/~mpromber
you mean like ?source ? On 26 Sep 2008, at 13:49, Michael Schulte wrote:> Dear R-people, > > I want to use an idea from LaTeX in the work flow with R. > It is possible in LaTeX to have a main file from which other files > are called (ie included). > So for example if you have book, the main index file would call each > chapter separately. > > Is there something comparable in R that follows the above 'include' > idea from LaTeX? > A main file that calls parts of an analysis or data preparation > separately. > > Thanks! > Michael > > ______________________________________________ > R-help at r-project.org 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.
Prof Brian Ripley
2008-Sep-26 13:20 UTC
[R] include scripts into main file (the LaTeX way)
This is hardly original to LaTeX (in fact even TeX has a way), and most programming languages have such a mechanism (e.g. #include in C). R's nearest equivalent is source(), but that does not have a mechanism like TEXINPUTS to search for files (but then neither does MikTeX). I believe I have seen a search implementation for source(), but R's package mechanism makes it much less necessary. On Fri, 26 Sep 2008, Michael Schulte wrote:> Dear R-people, > > I want to use an idea from LaTeX in the work flow with R. > It is possible in LaTeX to have a main file from which other files are called > (ie included). > So for example if you have book, the main index file would call each chapter > separately.Whereas in R you have functions and packages to encapsulate useful pieces of code.> Is there something comparable in R that follows the above 'include' idea from > LaTeX? > A main file that calls parts of an analysis or data preparation separately. > > Thanks! > Michael-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595