Skip to Content
Python and R for the Modern Data Scientist
book

Python and R for the Modern Data Scientist

by Rick J. Scavetta, Boyan Angelov
June 2021
Beginner to intermediate
196 pages
5h 1m
English
O'Reilly Media, Inc.
Content preview from Python and R for the Modern Data Scientist

Chapter 6. Using the Two Languages Synergistically

Interoperability, the ability for different programming languages to work together, is a cornerstone of computing. Ideally objects can be shared directly between the two languages. As you can imagine, this can be problematic for a variety of reasons, like memory usage and incompatible data storage structures to name just two. Although there have been several attempts to implement this smoothly between Python and R, it’s only been in the past couple of years that a reasonably functional kit had come to fruition. I’ll discuss this in “Interoperability”. But it’s useful to first return to the basics. This will not only give context to appreciate smooth interoperability later on but also give you a basic solution that may already meet your needs. Nonetheless, if you want to get started with interoperability, you can skip the next section.

Faux Operability

The most basic type of interoperability, sometimes called cross-talk, is more of a faux operability. Here, we execute predefined scripts across languages, passing information between them using files as intermediaries. Imagine the following situation, which I’ve diagrammed in Figure 6-1.

Figure 6-1. An example of cross-talk to facilitate interoperability

In R, after performing some necessary work on an object, e.g., PlantGrowth, we execute:

# (Previous interesting ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Practical Machine Learning in R

Practical Machine Learning in R

Fred Nwanganga, Mike Chapple
ggplot2 Essentials

ggplot2 Essentials

Donato Teutonico

Publisher Resources

ISBN: 9781492093398Errata Page