https://gist.github.com/3287286
Put this together last night. It will convert pandas DataFrame to an xts object if the index is Datetime. So something like:
rdaily = r['dailyReturn']
rdaily(df) # calling R function with DataFrame within python.
Will work without converting the df explicitly. Also means that
r.assign('xts_object', df) # properly converts df to xts
assert isinstance(r('dailyReturn(xts_object)'), DataFrame) # properly converts xts output to DataFrame on the python side.
I don't have a lot of test cases since I'm new to R. So caveat emptor. Just wanted to share and get suggestions if I'm approaching it wrong.