Skip to content
Advertisement

Embed R code in python

I need to make computations in a python program, and I would prefer to make some of them in R. Is it possible to embed R code in python ?

Advertisement

Answer

You should take a look at rpy (link to documentation here).

This allows you to do:

JavaScript

And then you can use the object called r to do computations just like you would do in R.

Here is an example extracted from the doc:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement