On Fri, 27 Feb 2009, Michael Olschimke wrote:
> Hi,
>
> is it possible to execute a script with R and go into interactive mode
> with the same session?
Yes, the mechanism is 'read the script file specified by
R_PROFILE_USER (or its defaults) and then continue interactively'.
See ?Startup.
> e.g.
>
> R < myscript.R
>> objects()
>
> Creating a .Rprofile is not an option for me.
You need to explain why you are rejecting the mechanism provided to
do this, and precisely what your constraints are. Note that the
locations of both R_PROFILE_USER and R_PROFILE_SITE are set by
environment variables, so it would be very unusual not to be able to
make use of them.
An R session is either interactive or it is not, and that is decided
early in the startup process. A session started by redirecting input
is not (unless overridden by command-line flags), and it will never
read normal input from anywhere other than stdin. There is no
equivalent of sink() for input.
>
> Thank you
>
> 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.
>
--
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