Python read .RData and save to csv

Have a question reading RData file by Python rpy2 module:

import rpy2.robjects as robjects    
robjects.r['load']("ALA_cmip5_climdex_2050s.RData")

Basically I want to use Python to read this R data file and save its content to csv format.


Problem is that, when I load it into robject, and see the output:

R object with classes: ('character',) mapped to:
<StrVector - Python:0x000002898177C688 / R:0x0000028982CB3BA0>
['climdex...., 'file', 'files', '.First', ..., 'results...., 'tavg', 'time.name', 'var']

Result is like above, the StrVector is not complete, so seems can not continue following works for now: get the whole contents and export them.

My idea is get the whole namelist in StrVector and recursively use robjects.r['each StrVector item'] to save the entire data contents.


So any suggestions to achieve that? or better ways.

链接地址: http://www.djcxy.com/p/38310.html

上一篇: R正则表达式gsub分隔字母和数字

下一篇: Python读取.RData并保存到csv