Interactive R Script Launch

I try to run interactive R (Windows XP) with a script input that launches several commands, and then leaves me on the R command line. However, when I run it, it exits.

For example, here is the input file:

test.r: 
x = 1
x

This is 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 prompt

Is there any way to run this without exiting R?

+3
source share
1 answer

I would do it differently.

Just write a script that launches the regular R GUI or terminal application (of your choice), but then also put the file .Rprofilein the same directory that contains the code that you want to execute each time.

. help(Startup) , R , .

+3

Source: https://habr.com/ru/post/1775031/


All Articles