本文介绍了怎么把R Markdown转换成HTML?即,“编织HTML"的含义是什么?在Rstudio 0.96中做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Rstudio 0.96中的R Markdown文件上按编织HTML"时会运行什么命令?

我的动机是,当我在另一个文本编辑环境中时,我可能想运行相同的命令,或者我可能希望在更大的makefile中组合该命令.

My motivation is that I might want to run the same command when I'm in another text editing environment or I might want to combine the command in a larger makefile.

推荐答案

Sys.sleep(30)放在大块中,您将清楚地看到RStudio调用了哪些命令.基本上是

Put Sys.sleep(30) in a chunk and you will see clearly what commands are called by RStudio. Basically they are

  1. library(knitr); knit()获取降价文件;
  2. RStudio具有内部功能,可将降价转换为HTML;
  1. library(knitr); knit() to get the markdown file;
  2. RStudio has internal functions to convert markdown to HTML;

在下一版本的 markdown 软件包.目前,您可以使用knitr::knit2html('your_file.Rmd')获取与RStudio相似的HTML文件.

The second step will be more transparent in the next version of the markdown package. Currently you can use knitr::knit2html('your_file.Rmd') to get a similar HTML file as RStudio gives you.

于2019/09/17更新:以上答案适用于RStudio v0.96(2012年).现在,R Markdown是通过rmarkdown::render()编译的,它使用Pandoc代替了已淘汰的R包 markdown .有关更多详细信息,请参见帖子 R Markdown,Knitr,Pandoc和Bookdown之间的关系.

Update on 2019/09/17: The above answer applies to RStudio v0.96 (in the year 2012). Now R Markdown is compiled through rmarkdown::render(), which uses Pandoc instead of the retired R package markdown. See the post Relationship between R Markdown, Knitr, Pandoc, and Bookdown for more details.

这篇关于怎么把R Markdown转换成HTML?即,“编织HTML"的含义是什么?在Rstudio 0.96中做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 04:02