R Markdown error when using cronR

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’
Execution halted

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:

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!

On Linux, the scheduled script should start with a line like this

#! /usr/bin/env Rscript

and maybe you would need to set the PANDOC location

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.