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

时间:2019-03-02 02:27:27

标签: r r-markdown knitr

我想使用datacamp/tutorial包在单个块上使用编织钩。按照下面的document,我可以使用greedy

来设置tutorial::go_interactive(greedy=FALSE, height=500)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) ```

from turtle import *
speed(100000)
for i in range(360):
    fd(2)
    left(1)

1 个答案:

答案 0 :(得分:1)

没关系。找到了答案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)
```