I am writing an R Markdown document using the Python engine of {reticulate}. I am quite happy with how it works.
The only thing is, I cannot use r
as a Python object name that I'm going to use in multiple chunks.
---
title: "Untitled"
output: html_document
---
## Object name `r`
```{python}
r = 10
print(r) ##> 10
```
```{python}
print(r) ##> <__main__.R object at 0x119ad37d0>
```
I understand r
is a good name when we use R objects from within a Python chunk. Since I know I am not going to do that in my project, I would like to use r
as a name for my Python object.
Is there any way to change the name, r
, for the R
object created by reticulate? Or, to tell reticulate not to create r
object?
I am aware of the two straightforward workarounds
- Don't use
r
for Python objects. - Write everything in one big chunk and not share
r
between Python chunks.
but I'd like to have more freedom.