I am attempting to use Windows Task Scheduler to automatically run R code daily using instructions from another StackOverflow question (Scheduling R Script). Window Task Scheduler correctly opens Rscript.exe and begins running the code; however, after a few lines of code it gives the error "Error: Memory Exhausted (limit reached?)" and stops running. I am able to execute this code in RStudio manually with no memory errors.
I have tried the following solutions based on various StackOverflow answers with no success:
- Increase memory priority of scheduled task (from original 7 to highest 4)
- Add library(methods) to R code
- Increase memory in R with Sys.setenv(R_MAX_VSIZE=16e9)
- Increase memory in .Renviron by adding R_MAX_VSIZE=100GB in RStudio