如何持续运行Rscript?

时间:2014-02-25 22:28:57

标签: r

我有一个文件Timer.R,我想在与交互式R会话分开的进程中执行。

# In Timer.R
library(tcltk)
z <- function () { 
  cat("Hello you!\n") 
  .id <<- tcl("after", 1000, z)
}
.id <<- tcl("after", 1000, z)
tcl("after", "info", .id)   # To get info about this scheduled task
tcl("after", "cancel", .id) # To cancel the currently scheduled task

麻烦的是,Rscript不是持久性的 - 当它到达文件末尾时终止:

# 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

有没有办法让Timer.R在后​​台持续运行?

0 个答案:

没有答案