gpt4 book ai didi

r - 来自任务计划管理器的针织错误

转载 作者:行者123 更新时间:2023-12-04 11:04:11 25 4
gpt4 key购买 nike

我正在尝试设置一个运行批处理文件的任务,该文件运行 .rmd文件应该针织 我是可爱的 .html每天归档。

如果我手动运行批处理文件,一切正常。但是,当我通过任务调度程序运行它时,我从命令提示符收到以下错误:

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

与您打开开始菜单时的用户相同的用户在任务调度程序中被列为“作者”。

批处理文件代码:
"C:\R\R-3.0.3\bin\x64\Rscript.exe" -e "library(knitr,dplyr); knitr::knit2html('C:/R/Rapporter/residual_model/Residual_v1.Rmd')"

我不知道该怎么做。

最佳答案

看起来你在 R 的工作目录中没有写权限。我建议你在运行 knit2html() 之前设置工作目录。 ,例如

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

IE。
"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')

关于r - 来自任务计划管理器的针织错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24691706/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com