【发布时间】:2020-09-06 10:17:36
【问题描述】:
我有 R markdown 文档,我想动态创建带有 ggplotly 图形的选项卡
---
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
library(ggplot2)
library(plotly)
```
```{r}
fig=ggplot(cars)+geom_point(aes(speed, dist))
```
# level 1
## level 2{.tabset .tabset-pills}
```{r echo=FALSE, results='asis'}
for (h in 1:3){
cat("###", h,'{-}', '\n\n')
ggplotly(fig)
cat( '\n\n')
}
```
我知道它与普通的 ggplot 图表不同,我在这里查看了解决方案:enter link description here 但它对我不起作用
【问题讨论】:
标签: for-loop r-markdown plotly