Modify r object with rpy2

拜拜、爱过 提交于 2019-12-06 06:27:13

I found code examples in the rpy2 documentation that helped me solve the problem: http://rpy2.readthedocs.io/en/version_2.8.x/rinterface.html#pass-by-value-paradigm.

One can access attributes of r objects via the do_slots method, which takes as argument the attribute name. See in the question for the full solution.

Edit:

There also is a do_slot_assign method that can be used for instance to change the design formula:

>>> dds.do_slot("design").r_repr()
'~lib'
>>> dds.do_slot_assign("design", Formula("~ treat"))
>>> dds.do_slot("design").r_repr()
'~treat'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!