从RMarkdown和Knitr中删除R输出中的散列

时间:2021-02-15 06:13:32

I am using RStudio to write my RMarkdown files. I would like to know how I can remove the hashes in the final HTML output file that is generated by a RMarkdown document? As an example of what I mean, please see page 4 of this document http://goo.gl/hWwYV. The output of head(movies) do not have hashes before each line, whereas it does in my output HTML file.

我正在使用RStudio来编写RMarkdown文件。我想知道如何删除RMarkdown文档生成的最终HTML输出文件中的散列?作为我的示例,请参见本文档的第4页http://goo.gl/hWwYV。head(电影)的输出在每一行之前都没有散列,而在我的输出HTML文件中是这样的。

Thank you.

谢谢你!

1 个解决方案

#1


64  

You can include in your chunk options something like

您可以在您的块选项中包含诸如此类的内容

comment=NA # to remove all hashes

or

comment='%' # to use a different character

More help on knitr available from here:

更多关于knitr的帮助,请点击这里:

http://yihui.name/knitr/options

http://yihui.name/knitr/options

If you are using RMarkdown as you mentioned, your chunk could look like this:

如果你像你提到的那样使用RMarkdown,你的数据块可能是这样的:

```{r comment=NA}
summary(cars)
```

#1


64  

You can include in your chunk options something like

您可以在您的块选项中包含诸如此类的内容

comment=NA # to remove all hashes

or

comment='%' # to use a different character

More help on knitr available from here:

更多关于knitr的帮助,请点击这里:

http://yihui.name/knitr/options

http://yihui.name/knitr/options

If you are using RMarkdown as you mentioned, your chunk could look like this:

如果你像你提到的那样使用RMarkdown,你的数据块可能是这样的:

```{r comment=NA}
summary(cars)
```