Is there some recommended way to pass data from R (in the form of data.table
) to Python without having to save the data to disc? I know i could use python modules from R using reticulate
(and i suppose same thing can be done on the other side using rpy2
), but from what i’ve read that hurts the overall performance of the libraries and therefore there is quite a big chance that it’s better to store to disc my r data.table
and read that same data from disc using python and running, say, lightgbm
, than to try to run lightgbm
using reticulate
or data.table
using rpy2.
Why don’t i just stick to either R or Python :
I prefer using r data.table
(as opposed to Pandas
) for my data manipulations, because it is way faster, more memory efficient and has a lot of features which i like, such as inequi joins, rolling joins, cartesian joins, and pretty straightforward melting and casting. I also like that whenever i ask a data.table
related question in stack overflow, i get a high-quality answer pretty fast, while for Pandas
i haven’t been so successful. However, there are tasks for which i prefer python, such as when it comes to gradient boosting or neural networks.