Reputation: 1712
I have an R function that processes trading data in an "infinite loop" from 9am to 5pm every day. Its output includes processed data that has to be uploaded to our webserver. This process takes a relatively long 2 minutes, but is independent of all other processes. Thus, I'd like to run it in the background.
In Linux, I would write an R script "upload_stuff.R", and in my main loop, include the line
system("Rscript upload_stuff.R &")
to run the upload on a separate core, so that it doesn't slow down the main worker.
What is the most elegant way to do this in Windows?
Upvotes: 3
Views: 1734
Reputation: 25225
If other processes is not dependent on this step, you can use
system("Rscript upload_stuff.R &", wait=FALSE)
This will then be run in the process background.
Upvotes: 3