我想知道是否可以获得帮助。
假设我有 3 个文件:
top-level.rmd
q1.rmd
q2.rmd
top-level.rmd
的内容:
---
title: "hw1-2330981"
author: "Ian Quah"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r child = 'q1.Rmd'}
```
```{r child = 'q2.Rmd'}
```
(对于格式奇怪的情况表示歉意)
q1.rmd
的内容:
---
title: "hw_sol_q1"
author: "Ian Quah"
date: "`r Sys.Date()`"
output: html_document
---
# Question 1: `pressure.csv` {.tabset}
## a) `getwd()`
```{r }
getwd()
```
以及
q2.rmd
的内容
---
title: "hw_sol_q1"
author: "Ian Quah"
date: "`r Sys.Date()`"
output: html_document
---
# Question 2: something else {.tabset}
## a) `getwd()`
```{r }
getwd()
```
我试图在主页上生成两个选项卡,其中每个选项卡包含一个相应的问题,所有子问题均采用平面格式(我们向下滚动以查看每个子问题的解决方案)。我尝试将
{.tabset}
添加到每个问题的顶级标题(见下文),但最终结果不是我所希望的。
TL;博士我想要
带有一些文本的顶级页面
|选项卡1| |选项卡2|
(选项卡 1 处于活动状态)
Q1.1
。 。 .
Q1.2
如果我点击选项卡 2,我就会看到
Q2.1
。 。 .
Q2.2
在顶层渲染
您需要在选项卡的
mother元素上指定
.tabset
类:
top-level.Rmd
---
title: "hw1-2330981"
author: "Ian Quah"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Questions {.tabset}
```{r child = 'q1.Rmd'}
```
```{r child = 'q2.Rmd'}
```
q1.Rmd
---
title: "hw_sol_q1"
author: "Ian Quah"
date: "`r Sys.Date()`"
output: html_document
---
## Question 1: `pressure.csv`
### a) `getwd()`
```{r }
getwd()
```
q2.Rmd
---
title: "hw_sol_q1"
author: "Ian Quah"
date: "`r Sys.Date()`"
output: html_document
---
## Question 2: something else
### a) `getwd()`
```{r }
getwd()
```