[R] Load a program at the front end

Luke Tierney luke at stat.uiowa.edu
Tue Oct 7 18:43:17 CEST 2008


Something like

     env R_PROFILE=prog.R R

may work for you.  You may need to call .First.sys at the beginning of
prog.R to get default packages loaded.

luke

On Tue, 7 Oct 2008, Gang Chen wrote:

> Thanks a lot for the suggestion!
>
> Unfortunately " R --no-save < prog.R" does not work well with my
> situation because prog.R
> contain lines such as readline() and () that require user response in
> the middle of the
> execution. I also tried other options such as "R -f prog.R" and "R
> --interactive < prog.R", and
> they all failed.
>
> Any other suggestions?
>
> Thanks,
> Gang
>
>
> On Mon, Oct 6, 2008 at 10:12 PM, Bernardo Rangel Tura
> <tura at centroin.com.br> wrote:
>> Em Qui, 2008-10-02 às 14:36 -0400, Gang Chen escreveu:
>>> I want to run a R program, prog.R,  interactively. My question is, is
>>> there a way I can start prog.R on the shell terminal when invoking R,
>>> instead of using source() inside R?
>>>
>>> TIA,
>>> Gang
>>
>> Hi Gang
>>
>> I my system just only type:
>>
>>  R --no-save <prog.R
>>
>> platform       x86_64-unknown-linux-gnu
>> arch           x86_64
>> os             linux-gnu
>> system         x86_64, linux-gnu
>> status         Patched
>> major          2
>> minor          7.2
>> year           2008
>> month          09
>> day            11
>> svn rev        46532
>> language       R
>> version.string R version 2.7.2 Patched (2008-09-11 r46532)
>>
>> --
>> Bernardo Rangel Tura, M.D,MPH,Ph.D
>> National Institute of Cardiology
>> Brazil
>
> ______________________________________________
> 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.
>

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu


More information about the R-help mailing list