[R] Sourcing commands but delaying their execution
Mark Wardle
mark at wardle.org
Fri Aug 3 19:32:24 CEST 2007
While I don't use such a workflow, one option would be to place the
series of commands in a function, and then run that as appropriate.
do.initialisation <- function() {
...
}
do.cleanup <- function() {
}
Best wishes,
Mark
On 03/08/07, Dennis Fisher <fisher at plessthan.com> wrote:
> Colleagues:
>
> I have encountered the following situation:
> SERIES OF COMMANDS
> source("File1")
> MORE COMMANDS
> source("File2")
>
> Optimally, I would like File1 and File2 to be merged into a single
> file (FileMerged). However, if I wrote the following:
> SERIES OF COMMANDS
> source("FileMerged")
> MORE COMMANDS
>
> I encounter an error: the File2 portion of FileMerged contains
> commands that cannot be executed properly until "MORE COMMANDS" are
> executed. Similarly, sourcing FileMerged after MORE COMMANDS does
> not work because MORE COMMANDS requires the information from the
> File1 portion of FileMerged.
>
> I am looking for a means to source FileMerged but not execute some of
> the commands immediately. Functionally this would look like:
> SERIES OF COMMANDS
> source("FileMerged") # but withhold execution of some of the commands
> MORE COMMANDS
> COMMAND TO EXECUTE THE WITHHELD COMMANDS
>
> Does R offer some option to accomplish this?
>
> Dennis
>
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone: 1-866-PLessThan (1-866-753-7784)
> Fax: 1-415-564-2220
> www.PLessThan.com
>
> ______________________________________________
> 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.
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
--
Dr. Mark Wardle
Clinical research fellow and specialist registrar, Neurology
Cardiff, UK
More information about the R-help
mailing list