To start RScript without a DOS window (on Windows)?

For a tcltk application, I would like to run an R script without opening a console window or without opening a DOS window. I already realized that by creating a link to RScript.exe, I can make the console window minimize to a minimum, but I wonder if I can completely avoid the console window?

+3
source share
1 answer

You want to run R in batch mode. It is pretty simple; There are some instructions here .

EDIT: I do not see the console window; Here are the steps I took.

1) I created a file with a name r.batcontaining a string Rterm --vanillaand saved it in the working directory of the R launch (as indicated Sys.getenv("USERPROFILE")).

2) R script, test.r, ( .

n <- 1e3
for(i in 1:10)
{
  qr.solve(matrix(runif(n*n), nrow = n), seq_len(n)/(n+1))  
}

, script, .

3) dos , r.bat, R <test.r> test.txt.

+3

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


All Articles