Is there a way in R to pause execution of a script until a file is created? I would like to pre-load R in advance to decrease the execution time when the input file is generated.
If you want to keep this in R, you might try the following code:
while (!file.exists(your.file.name)) {
Sys.sleep(1)
}
A shorter sleep duration would poll more frequently but might be slightly more CPU intensive.
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