Rstudio has recently been added Jobs functionality. It is very useful but in the open-source edition of RStudio, some function are limited.
I want to run script files using Job one by one (because of resource shortage or to use another job's output).
Are there any good methods to do it ? Of course I can do it making up all Job scripts into one script file, but I want to avoid it.
Any help would be greatly appreciated. Below is my example. (I'm mainly annoyed with resource shortage, but to simplify I took another situation as example)
## make a test script file
file.create("test_job_script.R")
cat("
Sys.sleep(1)
x <- x + 3
",
file = "test_job_script.R",
append = TRUE)
## one of my problem
x <- 1
for(i in 1:3) rstudioapi::jobRunScript(path = "test_job_script.R",
workingDir = getwd(),
importEnv = TRUE,
exportEnv = "R_GlobalEnv")
x # 4
# ### What I Want in this case
x <- 1
for(i in 1:3) x <- x + 3
x # 10