I have created a script that I can run in R Studio without issue.
I then created a .bat file to run the script which uses this code:
@echo on
"C:\R\R-4.0.4\bin\x64\R.exe" CMD BATCH C:\Documents\RScript.R
I have used this exact syntax to run R scripts in the past without issue, but for my new R script, it isn't working.
I can't figure out what is wrong since the R code works when run in R and the .bat code work when run on other R scripts. There is no error message -- CMD opens up, shows the .bat command for a bit, and then goes away without an error message.
The R script in question is fairly complex, but some relevant information might be that it:
- Uses read_csv to check an on-device file and write_csv to update it
- Uses read_csv to check a publicly-editable Google Sheets document consisting of URL and e-mail addresses
- Uses rvest for web scraping those URLs
- Uses gmailr to e-mail the results to any e-mail addresses included in the spreadsheet
My hunch is that the issue is related to these packages, since they access content that isn't stored on my machine.
Anyone know what to do?