Code Sample, a copy-pastable example if possible
from rpy2.robjects.numpy2ri import numpy2ri
from rpy2.robjects.packages import importr
from rpy2.robjects import pandas2ri
pandas2ri.activate()
r_statspackage = importr('stats', robject_translations={'format_perc': '_format_perc'})
r_result=pandas2ri.ri2py(r_statspackage.friedman_test(numpy2ri(df.as_matrix())))
r_result
R object with classes:................................
Problem description
When I run the code above, in which I'm performing a friedman test using the R function inputting a pandas dataframe as a matrix, the r_result is still an R object that makes it difficult to work with the solution.
However, when I run the following:
from rpy2.robjects.numpy2ri import numpy2ri
from rpy2.robjects.packages import importr
import pandas.rpy.common as com
r_statspackage = importr('stats', robject_translations={'format_perc': '_format_perc'})
r_result=com.convert_robj(r_statspackage.friedman_test(numpy2ri(df.as_matrix())))
r_result
is now a dictionary in which I can easily call the keys and get all the information that I need. For example r_result['p.value']
I'm reporting this issue based on the message that I found on the documentation:
"Warning Not all conversion functions in rpy2 are working exactly the same as the current methods in pandas. If you experience problems or limitations in comparison to the ones in pandas, please report this at the issue tracker."
Comment From: TomAugspurger
Looks like you might want report this on the rpy2 issue tracker.
Comment From: TomAugspurger
Some background: rpy2 is handling all the R interface stuff now: http://pandas-docs.github.io/pandas-docs-travis/r_interface.html?highlight=rpy2