here
here copied to clipboard
here incorrect working directory using cronr package
Hi
When you use here()
it starts in the wrong working directory when a RECURRING cronjob is set using the cronr package. With a ONCE executed cronjob it does work somehow
Example:
My working dir is /home/rstudio/R/r-projects
. I have set this in Global options. Moreover I have set in the .Rprofile this wd as starting dir for the cronjob. via CRON_LIVE
However when the cronjob starts here states:
here() starts at /home/rstudio
This is the old, initial wd
The solution is that I had to set the wd in the command line and than lib:
setwd("/home/rstudio/R/r-projects")
library(here)
However this shouldnt be the case officially. I dont know if this is an here
or cronr
issue btw. But a solution would be great!
I'm not familiar with the cronr package, but cronjobs have a very specific notion of the environment (working directory, environment variables, ...) they are executed in. The initial working directory of the R process is what drives the behavior of the here package.
@bnosac: Can you help?