At the Broad Imaging Platform the profiling group was divided. There were those who swore by Python, especially the tensorflow fanatics. These Pythonites claimed R wasn't even a programming language. On the other side of the divide were those who swore by R. Python couldn't hold a candle to R when working with tables. "R has so much stats cred!" the R-gonauts cried out.
Why settle for one when you can have both! Here is an example...
In [1]:
import pandas as pd
df = pd.DataFrame({
'cups_of_coffee': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
'productivity': [2, 5, 6, 8, 9, 8, 0, 1, 0, -1]
})
In [2]:
# enables the %%R magic, not necessary if you've already done this
# https://ipython.org/ipython-doc/2/config/extensions/rmagic.html
%load_ext rpy2.ipython
In [3]:
%%R -i df -r 200 --units in -w 5 -h 5
library(ggplot2)
ggplot(df, aes(x=cups_of_coffee, y=productivity)) + geom_line()
In [ ]: