我知道這個問題類似於this之一。但我無法在那裏找到解決方案,因此再次在此發佈。如何在命令行中複製針織HTML?
我想通過點擊「編織HTML」,但通過命令獲得與我相同的輸出。我tryied使用knit2html但它與格式食堂,不包括標題,kable不工作等
例子:
這是我test.Rmd文件,
---
title: "test"
output: html_document
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}
library(knitr,quietly=T)
kable(summary(cars))
```
You can also embed plots, for example:
```{r, echo=FALSE}
plot(cars)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
輸出:
針織HTML
knit2html
FWIW我喜歡命令行輸出。 – 2014-12-02 10:18:53
@KonradRudolph:它不適合我。這只是我提出的示例代碼。我的實際使用案例有一個8列10行的大表格。命令行輸出看起來很醜。 – Avinash 2014-12-02 10:20:08
這主要是因爲兩個選項(!)在默認情況下嚴格格式化表。查看我的答案以獲得改進的選項。 – 2014-12-02 10:35:31