Synopsis
I would like to produce a pdf file from an rmd script just by clicking a file / an icon so that my coworkers don\'t exhaust themselves by o
Assuming one has independently installed pandoc
on Windows
machine (which turned out to be the root of the problem in this case), she can do it in the following manner:
First: make a .R
file with the content like below
library(knitr)
library(rmarkdown)
setwd('C:/repos/r_tutorials/executable R files')
knit("RexecKnit.Rmd")
# render the generated markdown file.
render("RexecKnit.md")
Sys.sleep(3)
Second: make a .bat
file
Create a .bat file, say "my_bat_file.bat", and include the text below. However, the paths have to be adjusted:
"C:\R\R-3.2.2\bin\x64\R.exe" CMD BATCH --vanilla --slave "C:\path_to_your_file\your_file.R" "C:\path_to_your_file\your_file.Rout"
Third: Instruct Windows Task Scheduler
If the data is updated frequently, one can shedule the Task Scheduler in Windows to repeatedly execute the .bat
file once a week at certain time at night, so reports are there in the morning.