Quarto in-line chunks from both R and Python

I am struggling to get in-line chunks from both R and Python. Any ideas what I'm doing wrong?

---
title: "Untitled"
format: gfm
---

```{r}
library(reticulate)
```


```{r}
#| label: make-x-r
xr <- "This is from R"
```

```{python}
#| label: make-x-py
xpy = "This is from Python"
```


- `r xr`
- `python xpy`

This yields:

# Untitled


``` r
library(reticulate)
```

``` r
xr <- "This is from R"
```

``` python
xpy = "This is from Python"
```

- This is from R
- `python xpy`

I don't think there's currently any other way around it with knitr engine than using reticulate::py in R inline, e.g. :

---
format: gfm
---
```{r}
library(reticulate)
```
```{python}
#| label: make-x-py
xpy = "This is from Python"
```
- `{r} py$xpy`

renders as:



``` r
library(reticulate)
```

``` python
xpy = "This is from Python"
```

- This is from Python
```
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.