interactive R startup script
I'm trying to run interactive R (Windows XP) with an input script that runs a few commands, and then leaves me at the R command line prompt. However, when I run it, it exits.
For example, here's the input file:
test.r:
x = 1
x
Here's what happens when I run it with the input file as a parameter:
C:\>R --file test.t
>x = 1
>x
[1] 1
C:\> <--- exits and returns to 开发者_C百科prompt
Is there any way to run this without R exiting?
I'd do it the other way around.
Just write a script that starts the normal R GUI or terminal application (per your choice), but then also place a file .Rprofile
in the same directory which contains the code you want executed each and every time.
See help(Startup)
on details about the files R looks up at startup and this may become clearer.
精彩评论