Search code examples
rlatexknitrsweave

Is there a way in knitr to evaluate inline code chunks of other languages?


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.


Solution

  • 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.