Jannis
2013-Mar-14 16:13 UTC
[R] does R read commands from scripts instantanously or seuqently during processing
Dear R community, when I source a script into R via: R --slave < scriptname.R is the whole script file read at once during startup or is each indivdual line of code read seqnetially during the execution (i.e. directly before r processes the respective command)? In other words, can I savely edit the scriptname.R file even when an active R process still runs the command above? Thanks for your help Jannis
Jeff Newmiller
2013-Mar-14 16:52 UTC
[R] does R read commands from scripts instantanously or seuqently during processing
Your use of the "<" redirection operator is an operating system
feature, not an R feature. I am not aware of any operating system that that
would function properly in the use case you describe.
It is possible, and common, to construct your input file as a stream as you go.
But a stream is not a file on disk.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live
Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
Jannis <bt_jannis at yahoo.de> wrote:
>Dear R community,
>
>
>when I source a script into R via:
>
>
>R --slave < scriptname.R
>
>
>is the whole script file read at once during startup or is each
>indivdual line of code read seqnetially during the execution (i.e.
>directly before r processes the respective command)? In other words,
>can
>I savely edit the scriptname.R file even when an active R process
>still
>runs the command above?
>
>
>Thanks for your help
>Jannis
>
>______________________________________________
>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.
Rolf Turner
2013-Mar-14 21:47 UTC
[R] does R read commands from scripts instantanously or seuqently during processing
On 03/15/2013 05:13 AM, Jannis wrote:> Dear R community, > > > when I source a script into R via: > > > R --slave < scriptname.R > > > is the whole script file read at once during startup or is each > indivdual line of code read seqnetially during the execution (i.e. > directly before r processes the respective command)? In other words, > can I savely edit the scriptname.R file even when an active R process > still runs the command above?Experiment. Build a toy script with a loop that never terminates. Set it going. Edit the script and change the code so that the loop terminates. See what happens. [It seems to me that nothing happens, so that you *can* "safely" edit the script while the process runs. But further experimentation would be advisable.] cheers, Rolf Turner