R functions in Python - Reverse Reticulate?

Hi all,

I have a question about exposing user-defined R functions to Python code.

I have created R functions in my utils.R file. Currently, in my R Markdown document, I just run

source("utils.R")

and use the functions. The functions generally bring in relatively standard data types (data frames, numbers, dates).

I have some colleagues who use Python who want to use the functions, and I would (ideally) not like to rewrite them in Python.

Is there a way to use the reticulate package to turn them into files to be run from python directly (not from python through R).

Thanks!

There is the rpy2 interface but I could not get it working with R 4.0.0, Windows 10 and Jupyter.
Maybe you have more luck with a different configuration.

1 Like

Thanks -- I've found rpy2 finicky in the past, so I had hoped to avoid it, and just rely on reticulate's magic - but this might have to do.

Today I saw that version 3.3.3 of rpy2 solved a problem that I had with an earlier version. So maybe worth a second try?

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