Wait for the file to appear.

Is there a way in R to pause script execution until a file is created? I would like to preload R in advance in order to reduce the execution time when creating the input file.

+4
source share
1 answer

If you want to keep this in R, you can try the following code:

while (!file.exists(your.file.name)) {
  Sys.sleep(1)
}

A shorter duration of sleep will be more likely to be polled, but may be slightly more intense.

+7
source

All Articles