Shagun
Shagun

Reputation: 33

function that makes my loop to run after every x mins

I want a r function which makes my loop to run after evey 5 mins. I have a loop that downloads market data from google finance.I want this loop to run in the interval of every 30 mins. Is it possible?

Upvotes: 0

Views: 2612

Answers (2)

David Marx
David Marx

Reputation: 8558

An alternative to making your script loop: use an external job scheduling tool to call your script over the desired interval. If you have linux, I recommend checking out cron. Here's a SO response describing how to set up a cron job to kick off an R script: https://stackoverflow.com/a/10116439/819544

Upvotes: 3

Adam Hyland
Adam Hyland

Reputation: 1057

You can use Sys.sleep(100) to stop execution for 100 seconds. It's a little inefficient vs. running some other process in the same instance and setting up a proper timer. But it's pretty easy.

Upvotes: 3

Related Questions