我升级到 RStudio 1.0.44 ,似乎 knitr::opts_knit$set(root.dir = path) 其中路径是我的目录无法像以前一样工作。它抛出一条消息:
The working directory was changed to /... inside a notebook chunk. The working
directory will be reset when the chunk is finished running. Use the knitr
root.dir option in the setup chunk to change the the working directory for
notebook chunks.
此消息现在将出现在以下每个命令中。请注意,我还没有编织 rmd。我只是用它来运行命令。通过 setwd() 直接在命令行中设置工作目录会返回 getwd() 中的正确路径,但再次加载具有相对路径 (./...) 的文件将返回上述消息。完全相同的 rmd 在 RStudio 0.99.896 上运行良好。我缺少什么?
sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
>Running under: Windows 7 x64 (build 7601) Service Pack 1
other attached packages:
[1] scales_0.4.0 ggplot2_2.1.0 xtable_1.8-2 data.table_1.9.6
[5] dplyr_0.4.3 knitr_1.15 pander_0.6.0
您可以使用以下命令更改工作目录:
```{r "setup", include=FALSE}
knitr::opts_knit$set(root.dir = getwd()) # with something else than `getwd()`
```
如底部所述专用页面 http://rmarkdown.rstudio.com/r_notebooks.html#executing_code in rmarkdown
网站。
But Restart R and run all chunks
(可在 RStudio 的“运行>”选项卡中访问)在我的计算机上修复了完全相同的问题。
这有帮助吗?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)