I have a file Timer.Rthat I want to execute in a separate process from my interactive session R.
library(tcltk)
z <- function () {
cat("Hello you!\n")
.id <<- tcl("after", 1000, z)
}
.id <<- tcl("after", 1000, z)
tcl("after", "info", .id)
tcl("after", "cancel", .id)
The problem is that Rscriptit is not persistent - it terminates when it reaches the end of the file:
# In interactive session
system("C:/Program Files/R/R-3.0.2/bin/Rscript.exe Test.R", invisible = FALSE)
<Tcl> {R_call 00000000217CD078} timer
<Tcl>
> # Rscript has terminated by this point - timer is never run
Is there a way to keep Timer.Rconstant work in the background?
mchen source
share