RMarkdown:如何在单个块上使用挂钩?

RMarkdown: How to use hooks on individual chunks?

我想使用 datacamp/tutorial package. As per the following document 在单个块上使用 knitr 挂钩,我可以使用 tutorial::go_interactive(greedy=FALSE, height=500)[=18 设置 heightgreedy 两个选项=]

如何使用 knitr_hooks 为各个区块设置不同的变量?

例如,对于第一个块,我想将其设置为 greedy=TRUE,对于第二个,我想要 greedy=FALSE.

---
title: "Example Document"
author: "Your name here"
output:
  html_document:
    self_contained: false
---

```{r, include=FALSE}
tutorial::go_interactive()
```

Here's an example of a Python fiddle/

```{python}
a = 2
b = 3

print(a + b)
```


```{python}
x = 2
y = 3

print(x + y)
```

没关系。找到答案 here

你必须在块上设置 tut = FALSE 才能将其编织为普通块。

```{r, include=FALSE}
tutorial::go_interactive()
```

Here's an example of a Python fiddle/

```{python}
a = 2
b = 3

print(a + b)
```


```{python, tut=FALSE}
x = 2
y = 3

print(x + y)
```