Adnan Fiaz walks us through an example of using the reticulate
library to call Python from R:
So what exactly does reticulate do? It’s goal is to facilitate interoperability between Python and R. It does this by embedding a Python session within the R session which enables you to call Python functionality from within R. I’m not going to go into the nitty gritty of how the package works here; RStudio have done a great job in providing some excellent documentation and a webinar. Instead I’ll show a few examples of the main functionality.
Just like R, the House of Python was built upon packages. Except in Python you don’t load functionality from a package through a call to
library
but instead you import a module. reticulate mimics this behaviour and opens up all the goodness from the module that is imported.
This is a good intro to a package which is already useful but I think will be even better over time as R & Python interoperability becomes the norm. H/T R-Bloggers
Comments closed