In knitr
it is possible to use other languages in code blocks. For example, we can use:
```{python}
Some python code
```
We can use the R
engine inline with `r some R code`
Is it possible to use other languages in inline code?
For example, I would like to do something like this `python some code`.
Thanks.
Chunk options The initial line in a code chunk may include various options. For example, echo=FALSE indicates that the code will not be shown in the final document (though any results/output would still be displayed).
Code Chunk Options You can add options to each code chunk. These options allow you to customize how or if you want code to be processed or appear on the rendered output (pdf document, html document, etc). Code chunk options are added on the first line of a code chunk after the name, within the curly brackets.
A code chunk usually starts with ```{} and ends with ``` . You can write any number of lines of code in it. Inline R code is embedded in the narratives of the document using the syntax `r ` .
Evaluate inline with `r shell(...)`
The shell command could be a python script that produces output for inline display. You could even pass in a shell=python3 argument.
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