微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

R Markdown-无法在路径上找到图像

如何解决R Markdown-无法在路径上找到图像

我将图像保存在路径TypeError: merge.smart is not a function at Object.<anonymous> (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/config/webpack.prod.js:9:24) at Module._compile (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/v8-compile-cache/v8-compile-cache.js:194:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Module.require (internal/modules/cjs/loader.js:1040:19) at require (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/v8-compile-cache/v8-compile-cache.js:161:20) at WEBPACK_OPTIONS (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13) at requireConfig (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6) at /var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17 at Array.forEach (<anonymous>) at module.exports (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15) at /var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/cli.js:71:45 at Object.parse (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/yargs/yargs.js:576:18) at /var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/cli.js:49:8 at Object.<anonymous> (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/cli.js:366:3) at Module._compile (internal/modules/cjs/loader.js:1151:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Module.require (internal/modules/cjs/loader.js:1040:19) at require (internal/modules/cjs/helpers.js:72:18) at Object.<anonymous> (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack/bin/webpack.js:156:2) at Module._compile (internal/modules/cjs/loader.js:1151:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10) at Module.load (internal/modules/cjs/loader.js:1000:32) at Function.Module._load (internal/modules/cjs/loader.js:899:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 error Command Failed with exit code 1. 上。当我将此图像添加到我的R Markdown文件时,我不断收到此消息./static/static/images/air_quality.png

不确定是什么问题。

注意:R markdown文件中给出的路径(No image at path static/images/air_quality.png)是正确的。

我的问题是,为什么无法识别图像?

以下屏幕截图:

enter image description here

解决方法

此pandoc markdown语法![air quality](/static/images/air_quality.png)仅在markdown文件中有效。在使用R Markdown时,我必须将此代码更改为:

```{r air-quality,echo=FALSE,out.width = '100%'}
knitr::include_graphics("/static/images/air_quality.png",error = FALSE)
```
error = FALSE中的

include_graphics()很重要,因为没有该参数,它将引发相同的错误。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。