I am using Rmarkdown with python. What is the equivalent of the R inline code for python?
Example, in https://rmarkdown.rstudio.com/lesson-4.html I can do
``r x`
to display the value of x in the text. but If I do
``python x`
I just get the text python x
With this workaround, it's possible:
```{r setup, include=FALSE}
library(reticulate)
```
```{python include=FALSE}
result = 1 + 1
```
1 + 1 = `r py$result` # 1 + 1 = 2
Where py$result means: take the value of the Python variable called result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With