什么是“;针织HTML&x201D;在Rstudio 0.98中是否存在?
我试图弄清楚在RStudio版本0.98.1091中按下“knit HTML”按钮时RStudio使用的命令和默认选项,因为在控制台运行什么是“;针织HTML&x201D;在Rstudio 0.98中是否存在?,r,markdown,rstudio,knitr,r-markdown,R,Markdown,Rstudio,Knitr,R Markdown,我试图弄清楚在RStudio版本0.98.1091中按下“knit HTML”按钮时RStudio使用的命令和默认选项,因为在控制台运行knit()函数时,我得到的中间标记文件略有不同 具体来说,当我为R标记文件使用以下标题时: --- title: "Report Title" author: Daddy the Runner date: "`r format(Sys.time(), '%A, %B %d, %Y')`" output: html_document: keep_
knit()
函数时,我得到的中间标记文件略有不同
具体来说,当我为R标记文件使用以下标题时:
---
title: "Report Title"
author: Daddy the Runner
date: "`r format(Sys.time(), '%A, %B %d, %Y')`"
output:
html_document:
keep_md: true
---
---
title: "Report Title"
author: Daddy the Runner
date: "Saturday, January 10, 2015"
output:
html_document:
keep_md: true
---
按下“Knit HTML”按钮时,我会得到以下标记文件:
当我执行以下命令时:knit(“myReport.Rmd”)
,我得到以下标记文件:
---
title: "Report Title"
author: Daddy the Runner
date: "`r format(Sys.time(), '%A, %B %d, %Y')`"
output:
html_document:
keep_md: true
---
---
title: "Report Title"
author: Daddy the Runner
date: "Saturday, January 10, 2015"
output:
html_document:
keep_md: true
---
很明显,RStudio按钮正在使用一些其他选项生成中间标记文件,但我在RStudio文档中找不到任何关于它的信息
关键问题是日期行。由于某些原因,在生成标记文件时,RStudio不会执行头中的内联r块。(但是,它在生成最终HTML之前执行。)然而,knit()
函数调用在生成标记文件时执行内联块
我在两个标记文件中注意到的唯一其他区别与绘图的生成有关。这两种方法生成不同大小的图形(命令行:504 x 504)和(按钮:672 x 480),并将它们放置在不同的目录中
我尝试了这个问题中的建议,插入了一个Sys.sleep(30)
调用,但这并没有提供任何关于RStudio用来编写文档的调用的信息。它确实在R Markdown console窗口中暂停了输出,这是不必要的,因为RStudio保留了所有的输出。我在输出中没有看到的是RStudio发出的命令
如能深入了解这些差异的性质,我们将不胜感激。虽然我喜欢使用IDE环境和它们提供的便利,但我真的很想了解它们在做什么,这样我可以更好地预测它们的行为。当我查看RMarkdown选项卡(控制台选项卡右侧)时,它们看起来像是在运行
knitr::knit
,然后是一个相当复杂的pandoc
shell行
/usr/local/lib/rstudio/bin/pandoc/pandoc filename.utf8.md--到html--从标记+自动链接\u bare\u uris+ascii\u标识符+tex\u数学\u单反斜杠-隐式\u数字--输出filename.html--智能--电子邮件混淆无--自包含--独立--节分区--目录--目录--目录--目录深度3--模板/home/me/R/i686 pc linux gnu库/3.1/rmarkdown/rmd/h/default.html——变量“theme:flatly”——包含在header/tmp/user/1001/RtmpKz5GnI/rmarkdown-str3bba3848bd7b.html中——mathjax——变量“mathjax url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'--无突出显示--变量highlightjs=/home/cd/R/i686 pc linux gnu库/3.1/rmarkdown/rmd/h/highlight
从第一个/usr/local/lib/rstudio/bin/pandoc/pandoc
开始,我推断他们带来了自己的pandoc
,可能认为复制比调试更好,可以很好地处理每个人特有的pandoc
版本
因此,在我看来,RStudio正在做以下工作:
---
title: "Report Title"
author: Daddy the Runner
date: "`r format(Sys.time(), '%A, %B %d, %Y')`"
output:
html_document:
keep_md: true
---
发生了
正如@rawr在评论中指出的那样:
rmarkdown::render('your_document.Rmd', 'html_document', 'new_titel.html')
工作并创建与
Knit HTML
按钮相同的文档。我相信它目前使用RMarkdown包中的HTML\u文档
函数iirc,knitr::Knit
如果需要编织,则调用带有options@rawr你没记错。我能够使用rmarkdown::render重现RStudio结果,控制台输出中显示了大量的pandoc选项。谢谢你们的帮助。你们中的任何一个都可以复制并粘贴评论作为下面的答案,OP可以将其标记为已接受。