如何将 R Markdown 块放在不同的 HTML 标签中? [英] How to put R Markdown chunks in different HTML-tabs?

查看:37
本文介绍了如何将 R Markdown 块放在不同的 HTML 标签中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含很多块的 R 降价页面.是否可以呈现块出现在不同选项卡中的 HTML 页面?

I have an R markdown page with a lot of chunks. Is it possible to render an HTML-page in which the chunks appear in different tabs?

作为一个例子,我使用这个 .Rmd 文件:

As an example I use this .Rmd file:

---
title: "Example"
output: html_document
---

# Tab 1

```{r}
summary(cars)
```

# Tab 2

```{r, echo=FALSE}
plot(cars)
```

现在我想渲染一个 HTML 页面,其中包含两个不同选项卡中的两个块的内容.我该怎么做?

Now I want to render an HTML-page with the content of the two chunks in two different tabs. How can I do that?

这就是它的基本外观.

推荐答案

这适用于最新版本的 rmarkdown.您可能必须使用以下内容进行安装:

This works with the latest release of rmarkdown. You may have to use the following to install:

install.packages("rmarkdown", type = "source")

完成后,试试这个:

---
title: "Example"
output: html_document
---


## Tabbed Example {.tabset}

### Tab1

```{r}
summary(cars)
```

### Tab2

```{r, echo=FALSE}
plot(cars)
```

这篇关于如何将 R Markdown 块放在不同的 HTML 标签中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆