在RStudio升级1.0.44后,opts_knit $set(root.dir = path)不起作
发布时间:2020-12-14 01:07:13 所属栏目:Linux 来源:网络整理
导读:我升级到RStudio 1.0.44,似乎knitr :: opts_knit $set(root.dir = path)其中path是我的目录不像以前那样工作.它抛出一条消息: The working directory was changed to /... inside a notebook chunk. The workingdirectory will be reset when the chunk is
我升级到RStudio 1.0.44,似乎knitr :: opts_knit $set(root.dir = path)其中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()中的正确路径,但是再次加载具有相对路径(./ …)的文件将返回上面的消息. RStudio 0.99.896完全相同的rmd工作正常.我错过了什么? 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()` ``` 如rmarkdown网站dedicated page底部所述. 但重新启动R并运行所有块(可在RStudio的“运行>”选项卡中访问)修复了我的机器上的同样问题. 这有帮助吗? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |