I want to run a R code at a specific time that I need. And after the process finished, I want to terminate the R session.
If a code is as below,
tm<-Sys.time()
write.table(tm,file='OUT.TXT', sep='\t');
quit(save = "no")
What should I do to run this code at "2012-04-18 17:25:40". I need your help. Thanks in advance.
In recent versions of RStudio (0.99. 893 or later), select Addins and next select 'Schedule R scripts on Windows'. This will allow you to select a script to be scheduled at your specified timepoints. The script will be copied to the Rscript repo folder and will be launched from there each time.
To measure execution time of R code, we can use Sys. time function. Put it before and after the code and take difference of it to get the execution time of code.
Access the R Console To use the most recent version of R, use the module load command and then just type R. You'll see the normal startup text for an R terminal and an R command prompt instead of the server command prompt.
It is easiest to use the Task Scheduler of Windows, or a cron job under Linux. There you can specify a command or program that should be run at a certain time you specify.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With