Converting an RPy2 ListVector to a Python dictionary

前端 未结 7 1210
日久生厌
日久生厌 2020-12-09 16:46

The natural Python equivalent to a named list in R is a dict, but RPy2 gives you a ListVector object.

import rpy2.robjects as robjects

a = robjects.r(\'list         


        
相关标签:
7条回答
  • 2020-12-09 17:49

    You can also do the following:

    In

    dict(a.items())
    

    Out

    {'foo': R object with classes: ('character',) mapped to:
     ['barbat'], 'fizz': R object with classes: ('numeric',) mapped to:
     [123.000000]}
    
    0 讨论(0)
提交回复
热议问题