bnosac / taskscheduleR

Schedule R scripts/processes with the Windows task scheduler.
330 stars 72 forks source link

Start in #67

Closed Ben-Cox closed 5 years ago

Ben-Cox commented 5 years ago

Is there any way to specify the start in option through the taskscheduleR package? It would be really nice to be able to leverage an .Rproj file to set root directory so absolute paths don't need to be specified. This would make sharing taskscheduleR scripts much cleaner. Or is there some other way to achieve portability for scheduled scripts? Could here or rprojroot packages help with this?

jwijffels commented 5 years ago

This R packages interfaces with schtasks.exe. It does not have that start in option argument. The solution to your issue is that you should learn how to create environment variables and replace all your calls to here::here in your script with calls to Sys.getenv("YOUR_PROJECT") That will make your code portable and work on any platform. Not only RStudio or Windows.