access R objects in python


/ Published in: Python
Save to your folder(s)

使用rpy2访问R的对象


Copy this code and paste it in your HTML
  1. >>> from rpy2 import robjects
  2. >>> r = robjects.r
  3. >>> print r['pi']
  4. [1] 3.141593
  5. >>> print r('pi')
  6. [1] 3.141593
  7. >>> print r.pi
  8. [1] 3.141593

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.