I'm trying to automate an R script that renders a R Markdown file and outputs an html for a daily report. I initially did this on Windows with the RStudio add-on TaskScheduleR. Everything worked fine and the cron job ran the script everyday. But now i need to run the automation on a Linux VM which is where my issue comes up. I'm using the CronR RStudio addin for cron jobs to run the script. This gives the option to run the script once, minutely, hourly, daily, or monthly. When I chose to run the script once at a specific time it works fine, but when I try to actually automate it, I see this error in the log file:
Error in library(rmarkdown) : there is no package called ‘rmarkdown’
And i don't understand why I'm getting this error since the R Markdown package is installed on my IDE.
For reference here is the script I'm trying to automate:
library(rmarkdown) rmarkdown::render("/data/home/jp/R/helpdesk/DailyDashboard.Rmd", output_file = "/data/home/jp/R/helpdesk/DailyDashboard.html")
I might be missing something obvious but it's confusing me. I'm not sure why my terminal doesn't see the rmarkdown package I have installed and why it isn't running. Any advice would be much appreciated!