Similar to Rpython, the Rpithon package (http://rpithon.r-forge.r-project.org) allows users-to-execute Python code from R and exchange the data between Python and R. However, the underlying mechanisms between these, packages is fundamentally different. Wihle Rpithon communicates with Python from R through pipes, Rpython accomplishes the same task with JSON. A major advantage of Rpithon over Rpython are that multiple Python processes can be started within a R session. However, Rpithon is not very robust while exchanging large data objects between R and Python.
Rpython Session
1 Library (SQLDF)2Df_in <-Sqldf ('Select Year, Month, dayofmonth from tbl2008 limit', dbname ='/home/liuwensui/documents/data/flights.db')3 Library (Rpython)4 ## # R DATA. FRAME to PYTHON DICTIONARY # # #5Python.assign ('py_dict', df_in)6 ## # PASS PYTHON DICTIONARY back to R LIST7R_list <-Python.get ('py_dict')8 ## CONVERT R LIST to DATA. FRAME9Df_out <-data.frame (r_list)Ten Dim (df_out) One #[1] 3 A # - #Real 0m0.973s - #User 0m0.797s the #SYS 0m0.186s
Rpithon Session
1 Library (SQLDF)2Df_in <-Sqldf ('Select Year, Month, dayofmonth from tbl2008 limit', dbname ='/home/liuwensui/documents/data/flights.db')3 Library (Rpithon)4 ## # R DATA. FRAME to PYTHON DICTIONARY # # #5Pithon.assign ('py_dict', df_in)6 ## # PASS PYTHON DICTIONARY back to R LIST7R_list <-Pithon.get ('py_dict')8 ## CONVERT R LIST to DATA. FRAME9Df_out <-data.frame (r_list)Ten Dim (df_out) One #[1] 3 A # - #Real 0m0.984s - #User 0m0.771s the #SYS 0m0.187s
Transferred from: https://statcompute.wordpress.com/2015/03/30/rpithon-vs-rpython/
Rpithon vs. Rpython (ext.)