Knitr-error from task manager

I am trying to set up a task that runs a batch file that runs a file .rmdthat should knitr me a beautiful .htmlfile every day.

Everything works fine if I run the batch file manually. However, when I run it through the task scheduler, I get the following error from the command line:

Error in file(con, "w") : cannot open the connection
Calls: <Anonymous> -> knit -> writeLines -> file
In addition: Warning message:
In file<con, "w") : cannot open file 'residual_v1.md" : Permission denied
Execution halted

The same user appears as the "author" in the task scheduler, as the user when you open the Start menu.

Batch File Code:

"C:\R\R-3.0.3\bin\x64\Rscript.exe" -e "library(knitr,dplyr); knitr::knit2html('C:/R/Rapporter/residual_model/Residual_v1.Rmd')"

I'm losing what to do.

+4
source share
1 answer

, R. knit2html(), .

setwd('C:/R/Rapporter/residual_model/')
knitr::knit2html('Residual_v1.Rmd')

.

"C:\R\R-3.0.3\bin\x64\Rscript.exe" -e "setwd('C:/R/Rapporter/residual_model/'); knitr::knit2html('Residual_v1.Rmd')"

, :

setwd('any/output/directory/you/want')
knitr::knit2html('C:/R/Rapporter/residual_model/Residual_v1.Rmd')
+4

Source: https://habr.com/ru/post/1548029/


All Articles