Rmarkdown - python Rmarkdown 中的内联代码
Rmarkdown - python inline code in Rmarkdown
我在 python 中使用 Rmarkdown。 python 的 R
内联代码等效于什么?
例如,在 https://rmarkdown.rstudio.com/lesson-4.html 我可以做到
``r x`
显示文本中x的值。但如果我这样做
``python x`
我刚收到文字python x
不确定这是否可行。我发现的所有示例都使用 R 内联代码,如 `r py$x` 来实现这一点。参见例如rmarkdown cookbook.
使用此解决方法,可以:
```{r setup, include=FALSE}
library(reticulate)
```
```{python include=FALSE}
result = 1 + 1
```
1 + 1 = `r py$result` # 1 + 1 = 2
其中 py$result
表示:获取名为 result
.
的 Python 变量的值
我在 python 中使用 Rmarkdown。 python 的 R
内联代码等效于什么?
例如,在 https://rmarkdown.rstudio.com/lesson-4.html 我可以做到
``r x`
显示文本中x的值。但如果我这样做
``python x`
我刚收到文字python x
不确定这是否可行。我发现的所有示例都使用 R 内联代码,如 `r py$x` 来实现这一点。参见例如rmarkdown cookbook.
使用此解决方法,可以:
```{r setup, include=FALSE}
library(reticulate)
```
```{python include=FALSE}
result = 1 + 1
```
1 + 1 = `r py$result` # 1 + 1 = 2
其中 py$result
表示:获取名为 result
.